<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, BangPatterns #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK prune #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 701
</span><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Module      : Data.ByteString.Lazy</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Copyright   : (c) Don Stewart 2006</span><span>
</span><span id="line-11"></span><span class="hs-comment">--               (c) Duncan Coutts 2006-2011</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- License     : BSD-style</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Maintainer  : dons00@gmail.com, duncan@community.haskell.org</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Stability   : stable</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Portability : portable</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- A time and space-efficient implementation of lazy byte vectors</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- using lists of packed 'Word8' arrays, suitable for high performance</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- use, both in terms of large data quantities, or high speed</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- requirements. Lazy ByteStrings are encoded as lazy lists of strict chunks</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- of bytes.</span><span>
</span><span id="line-23"></span><span class="hs-comment">--</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- A key feature of lazy ByteStrings is the means to manipulate large or</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- unbounded streams of data without requiring the entire sequence to be</span><span>
</span><span id="line-26"></span><span class="hs-comment">-- resident in memory. To take advantage of this you have to write your</span><span>
</span><span id="line-27"></span><span class="hs-comment">-- functions in a lazy streaming style, e.g. classic pipeline composition. The</span><span>
</span><span id="line-28"></span><span class="hs-comment">-- default I\/O chunk size is 32k, which should be good in most circumstances.</span><span>
</span><span id="line-29"></span><span class="hs-comment">--</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- Some operations, such as 'concat', 'append', 'reverse' and 'cons', have</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- better complexity than their &quot;Data.ByteString&quot; equivalents, due to</span><span>
</span><span id="line-32"></span><span class="hs-comment">-- optimisations resulting from the list spine structure. For other</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- operations lazy ByteStrings are usually within a few percent of</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- strict ones.</span><span>
</span><span id="line-35"></span><span class="hs-comment">--</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- The recomended way to assemble lazy ByteStrings from smaller parts</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- is to use the builder monoid from &quot;Data.ByteString.Builder&quot;.</span><span>
</span><span id="line-38"></span><span class="hs-comment">--</span><span>
</span><span id="line-39"></span><span class="hs-comment">-- This module is intended to be imported @qualified@, to avoid name</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- clashes with &quot;Prelude&quot; functions.  eg.</span><span>
</span><span id="line-41"></span><span class="hs-comment">--</span><span>
</span><span id="line-42"></span><span class="hs-comment">-- &gt; import qualified Data.ByteString.Lazy as B</span><span>
</span><span id="line-43"></span><span class="hs-comment">--</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- Original GHC implementation by Bryan O\'Sullivan.</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- Rewritten to use 'Data.Array.Unboxed.UArray' by Simon Marlow.</span><span>
</span><span id="line-46"></span><span class="hs-comment">-- Rewritten to support slices and use 'Foreign.ForeignPtr.ForeignPtr'</span><span>
</span><span id="line-47"></span><span class="hs-comment">-- by David Roundy.</span><span>
</span><span id="line-48"></span><span class="hs-comment">-- Rewritten again and extended by Don Stewart and Duncan Coutts.</span><span>
</span><span id="line-49"></span><span class="hs-comment">-- Lazy variant by Duncan Coutts and Don Stewart.</span><span>
</span><span id="line-50"></span><span class="hs-comment">--</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.ByteString.Lazy</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span>        </span><span class="annot"><span class="hs-comment">-- * The @ByteString@ type</span></span><span>
</span><span id="line-55"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier">ByteString</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- instances: Eq, Ord, Show, Read, Data, Typeable</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Introducing and eliminating 'ByteString's</span></span><span>
</span><span id="line-58"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#empty"><span class="hs-identifier">empty</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString</span><span>
</span><span id="line-59"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#singleton"><span class="hs-identifier">singleton</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: Word8   -&gt; ByteString</span><span>
</span><span id="line-60"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#pack"><span class="hs-identifier">pack</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: [Word8] -&gt; ByteString</span><span>
</span><span id="line-61"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#unpack"><span class="hs-identifier">unpack</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; [Word8]</span><span>
</span><span id="line-62"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#fromStrict"><span class="hs-identifier">fromStrict</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- :: Strict.ByteString -&gt; ByteString</span><span>
</span><span id="line-63"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#toStrict"><span class="hs-identifier">toStrict</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: ByteString -&gt; Strict.ByteString</span><span>
</span><span id="line-64"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#fromChunks"><span class="hs-identifier">fromChunks</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- :: [Strict.ByteString] -&gt; ByteString</span><span>
</span><span id="line-65"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#toChunks"><span class="hs-identifier">toChunks</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: ByteString -&gt; [Strict.ByteString]</span><span>
</span><span id="line-66"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier">foldrChunks</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: (S.ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a</span><span>
</span><span id="line-67"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#foldlChunks"><span class="hs-identifier">foldlChunks</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: (a -&gt; S.ByteString -&gt; a) -&gt; a -&gt; ByteString -&gt; a</span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Basic interface</span></span><span>
</span><span id="line-70"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#cons"><span class="hs-identifier">cons</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-71"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#cons%27"><span class="hs-identifier">cons'</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-72"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#snoc"><span class="hs-identifier">snoc</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; Word8 -&gt; ByteString</span><span>
</span><span id="line-73"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#append"><span class="hs-identifier">append</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-74"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#head"><span class="hs-identifier">head</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; Word8</span><span>
</span><span id="line-75"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#uncons"><span class="hs-identifier">uncons</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; Maybe (Word8, ByteString)</span><span>
</span><span id="line-76"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#unsnoc"><span class="hs-identifier">unsnoc</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; Maybe (ByteString, Word8)</span><span>
</span><span id="line-77"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#last"><span class="hs-identifier">last</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; Word8</span><span>
</span><span id="line-78"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#tail"><span class="hs-identifier">tail</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-79"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#init"><span class="hs-identifier">init</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-80"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#null"><span class="hs-identifier">null</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; Bool</span><span>
</span><span id="line-81"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#length"><span class="hs-identifier">length</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; Int64</span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Transforming ByteStrings</span></span><span>
</span><span id="line-84"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span>                    </span><span class="hs-comment">-- :: (Word8 -&gt; Word8) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-85"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#reverse"><span class="hs-identifier">reverse</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-86"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#intersperse"><span class="hs-identifier">intersperse</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-87"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#intercalate"><span class="hs-identifier">intercalate</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString] -&gt; ByteString</span><span>
</span><span id="line-88"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#transpose"><span class="hs-identifier">transpose</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: [ByteString] -&gt; [ByteString]</span><span>
</span><span id="line-89"></span><span>
</span><span id="line-90"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Reducing 'ByteString's (folds)</span></span><span>
</span><span id="line-91"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl"><span class="hs-identifier">foldl</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a</span><span>
</span><span id="line-92"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl%27"><span class="hs-identifier">foldl'</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a</span><span>
</span><span id="line-93"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl1"><span class="hs-identifier">foldl1</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8</span><span>
</span><span id="line-94"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl1%27"><span class="hs-identifier">foldl1'</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8</span><span>
</span><span id="line-95"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#foldr"><span class="hs-identifier">foldr</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: (Word8 -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a</span><span>
</span><span id="line-96"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#foldr1"><span class="hs-identifier">foldr1</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8</span><span>
</span><span id="line-97"></span><span>
</span><span id="line-98"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Special folds</span></span><span>
</span><span id="line-99"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#concat"><span class="hs-identifier">concat</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: [ByteString] -&gt; ByteString</span><span>
</span><span id="line-100"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#concatMap"><span class="hs-identifier">concatMap</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Word8 -&gt; ByteString) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-101"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#any"><span class="hs-identifier">any</span></a></span><span class="hs-special">,</span><span>                    </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-102"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#all"><span class="hs-identifier">all</span></a></span><span class="hs-special">,</span><span>                    </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-103"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#maximum"><span class="hs-identifier">maximum</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: ByteString -&gt; Word8</span><span>
</span><span id="line-104"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#minimum"><span class="hs-identifier">minimum</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: ByteString -&gt; Word8</span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Building ByteStrings</span></span><span>
</span><span id="line-107"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Scans</span></span><span>
</span><span id="line-108"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#scanl"><span class="hs-identifier">scanl</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-109"></span><span class="hs-comment">--        scanl1,                 -- :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-110"></span><span class="hs-comment">--        scanr,                  -- :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-111"></span><span class="hs-comment">--        scanr1,                 -- :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Accumulating maps</span></span><span>
</span><span id="line-114"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#mapAccumL"><span class="hs-identifier">mapAccumL</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (acc -&gt; Word8 -&gt; (acc, Word8)) -&gt; acc -&gt; ByteString -&gt; (acc, ByteString)</span><span>
</span><span id="line-115"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#mapAccumR"><span class="hs-identifier">mapAccumR</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (acc -&gt; Word8 -&gt; (acc, Word8)) -&gt; acc -&gt; ByteString -&gt; (acc, ByteString)</span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Infinite ByteStrings</span></span><span>
</span><span id="line-118"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#repeat"><span class="hs-identifier">repeat</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: Word8 -&gt; ByteString</span><span>
</span><span id="line-119"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#replicate"><span class="hs-identifier">replicate</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: Int64 -&gt; Word8 -&gt; ByteString</span><span>
</span><span id="line-120"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#cycle"><span class="hs-identifier">cycle</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-121"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#iterate"><span class="hs-identifier">iterate</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString</span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Unfolding ByteStrings</span></span><span>
</span><span id="line-124"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#unfoldr"><span class="hs-identifier">unfoldr</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (a -&gt; Maybe (Word8, a)) -&gt; a -&gt; ByteString</span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Substrings</span></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Breaking strings</span></span><span>
</span><span id="line-129"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#take"><span class="hs-identifier">take</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Int64 -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-130"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#drop"><span class="hs-identifier">drop</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Int64 -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-131"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: Int64 -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-132"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#takeWhile"><span class="hs-identifier">takeWhile</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-133"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#dropWhile"><span class="hs-identifier">dropWhile</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-134"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#span"><span class="hs-identifier">span</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-135"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#break"><span class="hs-identifier">break</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-136"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#group"><span class="hs-identifier">group</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString]</span><span>
</span><span id="line-137"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#groupBy"><span class="hs-identifier">groupBy</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (Word8 -&gt; Word8 -&gt; Bool) -&gt; ByteString -&gt; [ByteString]</span><span>
</span><span id="line-138"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#inits"><span class="hs-identifier">inits</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString]</span><span>
</span><span id="line-139"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#tails"><span class="hs-identifier">tails</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString]</span><span>
</span><span id="line-140"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#stripPrefix"><span class="hs-identifier">stripPrefix</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Maybe ByteString</span><span>
</span><span id="line-141"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#stripSuffix"><span class="hs-identifier">stripSuffix</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Maybe ByteString</span><span>
</span><span id="line-142"></span><span>
</span><span id="line-143"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Breaking into many substrings</span></span><span>
</span><span id="line-144"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#split"><span class="hs-identifier">split</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; [ByteString]</span><span>
</span><span id="line-145"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#splitWith"><span class="hs-identifier">splitWith</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; [ByteString]</span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Predicates</span></span><span>
</span><span id="line-148"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#isPrefixOf"><span class="hs-identifier">isPrefixOf</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-149"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#isSuffixOf"><span class="hs-identifier">isSuffixOf</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-150"></span><span class="hs-comment">--        isInfixOf,              -- :: ByteString -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Search for arbitrary substrings</span></span><span>
</span><span id="line-153"></span><span class="hs-comment">--        isSubstringOf,          -- :: ByteString -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-154"></span><span class="hs-comment">--        findSubstring,          -- :: ByteString -&gt; ByteString -&gt; Maybe Int</span><span>
</span><span id="line-155"></span><span class="hs-comment">--        findSubstrings,         -- :: ByteString -&gt; ByteString -&gt; [Int]</span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Searching ByteStrings</span></span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Searching by equality</span></span><span>
</span><span id="line-160"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#elem"><span class="hs-identifier">elem</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-161"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#notElem"><span class="hs-identifier">notElem</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Searching with a predicate</span></span><span>
</span><span id="line-164"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#find"><span class="hs-identifier">find</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Word8</span><span>
</span><span id="line-165"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#filter"><span class="hs-identifier">filter</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-166"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#partition"><span class="hs-identifier">partition</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Indexing ByteStrings</span></span><span>
</span><span id="line-169"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#index"><span class="hs-identifier">index</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; Int64 -&gt; Word8</span><span>
</span><span id="line-170"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#elemIndex"><span class="hs-identifier">elemIndex</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; Maybe Int64</span><span>
</span><span id="line-171"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#elemIndexEnd"><span class="hs-identifier">elemIndexEnd</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; Maybe Int64</span><span>
</span><span id="line-172"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#elemIndices"><span class="hs-identifier">elemIndices</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; [Int64]</span><span>
</span><span id="line-173"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndex"><span class="hs-identifier">findIndex</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Int64</span><span>
</span><span id="line-174"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndexEnd"><span class="hs-identifier">findIndexEnd</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Int64</span><span>
</span><span id="line-175"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndices"><span class="hs-identifier">findIndices</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; [Int64]</span><span>
</span><span id="line-176"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#count"><span class="hs-identifier">count</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: Word8 -&gt; ByteString -&gt; Int64</span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Zipping and unzipping ByteStrings</span></span><span>
</span><span id="line-179"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#zip"><span class="hs-identifier">zip</span></a></span><span class="hs-special">,</span><span>                    </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; [(Word8,Word8)]</span><span>
</span><span id="line-180"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#zipWith"><span class="hs-identifier">zipWith</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (Word8 -&gt; Word8 -&gt; c) -&gt; ByteString -&gt; ByteString -&gt; [c]</span><span>
</span><span id="line-181"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#unzip"><span class="hs-identifier">unzip</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: [(Word8,Word8)] -&gt; (ByteString,ByteString)</span><span>
</span><span id="line-182"></span><span>
</span><span id="line-183"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Ordered ByteStrings</span></span><span>
</span><span id="line-184"></span><span class="hs-comment">--        sort,                   -- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-185"></span><span>
</span><span id="line-186"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Low level conversions</span></span><span>
</span><span id="line-187"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Copying ByteStrings</span></span><span>
</span><span id="line-188"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#copy"><span class="hs-identifier">copy</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-189"></span><span class="hs-comment">--        defrag,                -- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span>        </span><span class="annot"><span class="hs-comment">-- * I\/O with 'ByteString's</span></span><span>
</span><span id="line-192"></span><span>
</span><span id="line-193"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Standard input and output</span></span><span>
</span><span id="line-194"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#getContents"><span class="hs-identifier">getContents</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: IO ByteString</span><span>
</span><span id="line-195"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#putStr"><span class="hs-identifier">putStr</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; IO ()</span><span>
</span><span id="line-196"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#putStrLn"><span class="hs-identifier">putStrLn</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: ByteString -&gt; IO ()</span><span>
</span><span id="line-197"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#interact"><span class="hs-identifier">interact</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: (ByteString -&gt; ByteString) -&gt; IO ()</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Files</span></span><span>
</span><span id="line-200"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#readFile"><span class="hs-identifier">readFile</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: FilePath -&gt; IO ByteString</span><span>
</span><span id="line-201"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#writeFile"><span class="hs-identifier">writeFile</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: FilePath -&gt; ByteString -&gt; IO ()</span><span>
</span><span id="line-202"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#appendFile"><span class="hs-identifier">appendFile</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- :: FilePath -&gt; ByteString -&gt; IO ()</span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** I\/O with Handles</span></span><span>
</span><span id="line-205"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetContents"><span class="hs-identifier">hGetContents</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- :: Handle -&gt; IO ByteString</span><span>
</span><span id="line-206"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#hGet"><span class="hs-identifier">hGet</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Handle -&gt; Int -&gt; IO ByteString</span><span>
</span><span id="line-207"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetNonBlocking"><span class="hs-identifier">hGetNonBlocking</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- :: Handle -&gt; Int -&gt; IO ByteString</span><span>
</span><span id="line-208"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#hPut"><span class="hs-identifier">hPut</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Handle -&gt; ByteString -&gt; IO ()</span><span>
</span><span id="line-209"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#hPutNonBlocking"><span class="hs-identifier">hPutNonBlocking</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- :: Handle -&gt; ByteString -&gt; IO ByteString</span><span>
</span><span id="line-210"></span><span>        </span><span class="annot"><a href="Data.ByteString.Lazy.html#hPutStr"><span class="hs-identifier">hPutStr</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: Handle -&gt; ByteString -&gt; IO ()</span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-keyword">hiding</span><span>
</span><span id="line-215"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier">reverse</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#head"><span class="hs-identifier">head</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#tail"><span class="hs-identifier">tail</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#last"><span class="hs-identifier">last</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#init"><span class="hs-identifier">init</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier">null</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier">length</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.OldList.html#lines"><span class="hs-identifier">lines</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier">foldl</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier">foldr</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.OldList.html#unlines"><span class="hs-identifier">unlines</span></a></span><span>
</span><span id="line-216"></span><span>    </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier">concat</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier">any</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier">take</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier">drop</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#takeWhile"><span class="hs-identifier">takeWhile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#dropWhile"><span class="hs-identifier">dropWhile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#span"><span class="hs-identifier">span</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier">break</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-identifier">elem</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier">filter</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#maximum"><span class="hs-identifier">maximum</span></a></span><span>
</span><span id="line-217"></span><span>    </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#minimum"><span class="hs-identifier">minimum</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier">all</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier">concatMap</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl1"><span class="hs-identifier">foldl1</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr1"><span class="hs-identifier">foldr1</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#scanl"><span class="hs-identifier">scanl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.List.html#scanl1"><span class="hs-identifier">scanl1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.List.html#scanr"><span class="hs-identifier">scanr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.List.html#scanr1"><span class="hs-identifier">scanr1</span></a></span><span>
</span><span id="line-218"></span><span>    </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#repeat"><span class="hs-identifier">repeat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.List.html#cycle"><span class="hs-identifier">cycle</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#interact"><span class="hs-identifier">interact</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.List.html#iterate"><span class="hs-identifier">iterate</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#readFile"><span class="hs-identifier">readFile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#writeFile"><span class="hs-identifier">writeFile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#appendFile"><span class="hs-identifier">appendFile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier">replicate</span></a></span><span>
</span><span id="line-219"></span><span>    </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#getContents"><span class="hs-identifier">getContents</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#getLine"><span class="hs-identifier">getLine</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#putStr"><span class="hs-identifier">putStr</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#putStrLn"><span class="hs-identifier">putStrLn</span></a></span><span> </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier">zip</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier">zipWith</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier">unzip</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#notElem"><span class="hs-identifier">notElem</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>              </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">L</span></span><span>  </span><span class="hs-comment">-- L for list/lazy</span><span>
</span><span id="line-222"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.html"><span class="hs-identifier">Data.ByteString</span></a></span><span>        </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">P</span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier">ByteString</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- type name only</span><span>
</span><span id="line-223"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.html"><span class="hs-identifier">Data.ByteString</span></a></span><span>        </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>  </span><span class="hs-comment">-- S for strict (hmm...)</span><span>
</span><span id="line-224"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html"><span class="hs-identifier">Data.ByteString.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>
</span><span id="line-225"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.Unsafe.html"><span class="hs-identifier">Data.ByteString.Unsafe</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>
</span><span id="line-226"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html"><span class="hs-identifier">Data.ByteString.Lazy.Internal</span></a></span><span class="hs-cpp">

#if !(MIN_VERSION_base(4,8,0))
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Applicative</span><span>      </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator">&lt;$&gt;</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-230"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Monoid</span><span>              </span><span class="hs-special">(</span><span class="hs-identifier">Monoid</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>            </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-identifier">mplus</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-233"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Word.html#"><span class="hs-identifier">Data.Word</span></a></span><span>                </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier">Word8</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-234"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Int.html#"><span class="hs-identifier">Data.Int</span></a></span><span>                 </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier">Int64</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-235"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#"><span class="hs-identifier">System.IO</span></a></span><span>                </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier">Handle</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.IO.StdHandles.html#openBinaryFile"><span class="hs-identifier">openBinaryFile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.IO.StdHandles.html#stdin"><span class="hs-identifier">stdin</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.IO.StdHandles.html#stdout"><span class="hs-identifier">stdout</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#withBinaryFile"><span class="hs-identifier">withBinaryFile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.IO.IOMode.html#IOMode"><span class="hs-identifier">IOMode</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-236"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.IO.Handle.html#hClose"><span class="hs-identifier">hClose</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-237"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Error.html#"><span class="hs-identifier">System.IO.Error</span></a></span><span>          </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/System.IO.Error.html#mkIOError"><span class="hs-identifier">mkIOError</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Error.html#illegalOperationErrorType"><span class="hs-identifier">illegalOperationErrorType</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-238"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Unsafe.html#"><span class="hs-identifier">System.IO.Unsafe</span></a></span><span>
</span><span id="line-239"></span><span>
</span><span id="line-240"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.ForeignPtr.html#"><span class="hs-identifier">Foreign.ForeignPtr</span></a></span><span>       </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#withForeignPtr"><span class="hs-identifier">withForeignPtr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-241"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Ptr.html#"><span class="hs-identifier">Foreign.Ptr</span></a></span><span>
</span><span id="line-242"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Storable.html#"><span class="hs-identifier">Foreign.Storable</span></a></span><span>
</span><span id="line-243"></span><span>
</span><span id="line-244"></span><span>
</span><span id="line-245"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-246"></span><span class="hs-comment">-- Introducing and eliminating 'ByteString's</span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span class="hs-comment">-- | /O(1)/ The empty 'ByteString'</span><span>
</span><span id="line-249"></span><span class="annot"><a href="Data.ByteString.Lazy.html#empty"><span class="hs-identifier hs-type">empty</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-250"></span><span id="empty"><span class="annot"><span class="annottext">empty :: ByteString
</span><a href="Data.ByteString.Lazy.html#empty"><span class="hs-identifier hs-var hs-var">empty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-251"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#empty"><span class="hs-pragma hs-type">empty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span class="hs-comment">-- | /O(1)/ Convert a 'Word8' into a 'ByteString'</span><span>
</span><span id="line-254"></span><span class="annot"><a href="Data.ByteString.Lazy.html#singleton"><span class="hs-identifier hs-type">singleton</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-255"></span><span id="singleton"><span class="annot"><span class="annottext">singleton :: Word8 -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#singleton"><span class="hs-identifier hs-var hs-var">singleton</span></a></span></span><span> </span><span id="local-6989586621679075576"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075576"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#singleton"><span class="hs-identifier hs-var">S.singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075576"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-256"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-257"></span><span>
</span><span id="line-258"></span><span class="hs-comment">-- | /O(n)/ Convert a '[Word8]' into a 'ByteString'.</span><span>
</span><span id="line-259"></span><span class="annot"><a href="Data.ByteString.Lazy.html#pack"><span class="hs-identifier hs-type">pack</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-260"></span><span id="pack"><span class="annot"><span class="annottext">pack :: [Word8] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#pack"><span class="hs-identifier hs-var hs-var">pack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Word8] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#packBytes"><span class="hs-identifier hs-var">packBytes</span></a></span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span class="hs-comment">-- | /O(n)/ Converts a 'ByteString' to a '[Word8]'.</span><span>
</span><span id="line-263"></span><span class="annot"><a href="Data.ByteString.Lazy.html#unpack"><span class="hs-identifier hs-type">unpack</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-264"></span><span id="unpack"><span class="annot"><span class="annottext">unpack :: ByteString -&gt; [Word8]
</span><a href="Data.ByteString.Lazy.html#unpack"><span class="hs-identifier hs-var hs-var">unpack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [Word8]
</span><a href="Data.ByteString.Lazy.Internal.html#unpackBytes"><span class="hs-identifier hs-var">unpackBytes</span></a></span><span>
</span><span id="line-265"></span><span>
</span><span id="line-266"></span><span class="hs-comment">-- | /O(c)/ Convert a list of strict 'ByteString' into a lazy 'ByteString'</span><span>
</span><span id="line-267"></span><span class="annot"><a href="Data.ByteString.Lazy.html#fromChunks"><span class="hs-identifier hs-type">fromChunks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-268"></span><span id="fromChunks"><span class="annot"><span class="annottext">fromChunks :: [ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#fromChunks"><span class="hs-identifier hs-var hs-var">fromChunks</span></a></span></span><span> </span><span id="local-6989586621679075571"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075571"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; ByteString -&gt; [ByteString] -&gt; ByteString
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">L.foldr</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#chunk"><span class="hs-identifier hs-var">chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075571"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-269"></span><span>
</span><span id="line-270"></span><span class="hs-comment">-- | /O(c)/ Convert a lazy 'ByteString' into a list of strict 'ByteString'</span><span>
</span><span id="line-271"></span><span class="annot"><a href="Data.ByteString.Lazy.html#toChunks"><span class="hs-identifier hs-type">toChunks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-272"></span><span id="toChunks"><span class="annot"><span class="annottext">toChunks :: ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#toChunks"><span class="hs-identifier hs-var hs-var">toChunks</span></a></span></span><span> </span><span id="local-6989586621679075569"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075569"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; [ByteString] -&gt; [ByteString])
-&gt; [ByteString] -&gt; ByteString -&gt; [ByteString]
forall a. (ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier hs-var">foldrChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075569"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span class="hs-comment">-- |/O(1)/ Convert a strict 'ByteString' into a lazy 'ByteString'.</span><span>
</span><span id="line-275"></span><span class="annot"><a href="Data.ByteString.Lazy.html#fromStrict"><span class="hs-identifier hs-type">fromStrict</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-276"></span><span id="fromStrict"><span class="annot"><span class="annottext">fromStrict :: ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#fromStrict"><span class="hs-identifier hs-var hs-var">fromStrict</span></a></span></span><span> </span><span id="local-6989586621679075568"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075568"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075568"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-277"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075568"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span class="hs-comment">-- |/O(n)/ Convert a lazy 'ByteString' into a strict 'ByteString'.</span><span>
</span><span id="line-280"></span><span class="hs-comment">--</span><span>
</span><span id="line-281"></span><span class="hs-comment">-- Note that this is an /expensive/ operation that forces the whole lazy</span><span>
</span><span id="line-282"></span><span class="hs-comment">-- ByteString into memory and then copies all the data. If possible, try to</span><span>
</span><span id="line-283"></span><span class="hs-comment">-- avoid converting back and forth between strict and lazy bytestrings.</span><span>
</span><span id="line-284"></span><span class="hs-comment">--</span><span>
</span><span id="line-285"></span><span class="annot"><a href="Data.ByteString.Lazy.html#toStrict"><span class="hs-identifier hs-type">toStrict</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">S.ByteString</span></a></span><span>
</span><span id="line-286"></span><span id="toStrict"><span class="annot"><span class="annottext">toStrict :: ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#toStrict"><span class="hs-identifier hs-var hs-var">toStrict</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679075566"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075566"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075565"><span class="hs-identifier hs-var">goLen0</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075566"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075566"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-287"></span><span>    </span><span class="hs-comment">-- We pass the original [ByteString] (bss0) through as an argument through</span><span>
</span><span id="line-288"></span><span>    </span><span class="hs-comment">-- goLen0, goLen1, and goLen since we will need it again in goCopy. Passing</span><span>
</span><span id="line-289"></span><span>    </span><span class="hs-comment">-- it as an explicit argument avoids capturing it in these functions'</span><span>
</span><span id="line-290"></span><span>    </span><span class="hs-comment">-- closures which would result in unnecessary closure allocation.</span><span>
</span><span id="line-291"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-292"></span><span>    </span><span class="hs-comment">-- It's still possible that the result is empty</span><span>
</span><span id="line-293"></span><span>    </span><span id="local-6989586621679075565"><span class="annot"><span class="annottext">goLen0 :: ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075565"><span class="hs-identifier hs-var hs-var">goLen0</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>   </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.html#empty"><span class="hs-identifier hs-var">S.empty</span></a></span><span>
</span><span id="line-294"></span><span>    </span><span class="annot"><a href="#local-6989586621679075565"><span class="hs-identifier hs-var">goLen0</span></a></span><span> </span><span id="local-6989586621679075563"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075563"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075562"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075562"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075561"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075561"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075562"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075565"><span class="hs-identifier hs-var">goLen0</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075563"><span class="hs-identifier hs-var">cs0</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075561"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-295"></span><span>    </span><span class="annot"><a href="#local-6989586621679075565"><span class="hs-identifier hs-var">goLen0</span></a></span><span> </span><span id="local-6989586621679075560"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075560"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075559"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075559"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075558"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075558"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075557"><span class="hs-identifier hs-var">goLen1</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075560"><span class="hs-identifier hs-var">cs0</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075559"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075558"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-296"></span><span>
</span><span id="line-297"></span><span>    </span><span class="hs-comment">-- It's still possible that the result is a single chunk</span><span>
</span><span id="line-298"></span><span>    </span><span id="local-6989586621679075557"><span class="annot"><span class="annottext">goLen1 :: ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075557"><span class="hs-identifier hs-var hs-var">goLen1</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>   </span><span id="local-6989586621679075556"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075556"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075556"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-299"></span><span>    </span><span class="annot"><a href="#local-6989586621679075557"><span class="hs-identifier hs-var">goLen1</span></a></span><span> </span><span id="local-6989586621679075555"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075555"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span id="local-6989586621679075554"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075554"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075553"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075553"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075552"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075552"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-300"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075553"><span class="hs-identifier hs-var">c</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075557"><span class="hs-identifier hs-var">goLen1</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075555"><span class="hs-identifier hs-var">cs0</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075554"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075552"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-301"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span>
</span><span id="line-302"></span><span>        </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075551"><span class="hs-identifier hs-var">goLen</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075555"><span class="hs-identifier hs-var">cs0</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Int -&gt; Int -&gt; Int
</span><a href="Data.ByteString.Internal.html#checkedAdd"><span class="hs-identifier hs-var">S.checkedAdd</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Lazy.concat&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075554"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075553"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075552"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-303"></span><span>
</span><span id="line-304"></span><span>    </span><span class="hs-comment">-- General case, just find the total length we'll need</span><span>
</span><span id="line-305"></span><span>    </span><span id="local-6989586621679075551"><span class="annot"><span class="annottext">goLen :: ByteString -&gt; Int -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075551"><span class="hs-identifier hs-var hs-var">goLen</span></a></span></span><span> </span><span id="local-6989586621679075548"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075548"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679075547"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075547"><span class="hs-identifier hs-var">total</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075546"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075546"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075545"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075545"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075551"><span class="hs-identifier hs-var">goLen</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075548"><span class="hs-identifier hs-var">cs0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075544"><span class="hs-identifier hs-var">total'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075545"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-306"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-307"></span><span>        </span><span id="local-6989586621679075544"><span class="annot"><span class="annottext">total' :: Int
</span><a href="#local-6989586621679075544"><span class="hs-identifier hs-var hs-var">total'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int -&gt; Int -&gt; Int
</span><a href="Data.ByteString.Internal.html#checkedAdd"><span class="hs-identifier hs-var">S.checkedAdd</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Lazy.concat&quot;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075547"><span class="hs-identifier hs-var">total</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075546"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-308"></span><span>    </span><span class="annot"><a href="#local-6989586621679075551"><span class="hs-identifier hs-var">goLen</span></a></span><span> </span><span id="local-6989586621679075543"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075543"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span id="local-6989586621679075542"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075542"><span class="hs-identifier hs-var">total</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-309"></span><span>      </span><span class="annot"><span class="annottext">Int -&gt; (Ptr Word8 -&gt; IO ()) -&gt; ByteString
</span><a href="Data.ByteString.Internal.html#unsafeCreate"><span class="hs-identifier hs-var">S.unsafeCreate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075542"><span class="hs-identifier hs-var">total</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO ()) -&gt; ByteString)
-&gt; (Ptr Word8 -&gt; IO ()) -&gt; ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679075540"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075540"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Ptr Word8 -&gt; IO ()
</span><a href="#local-6989586621679075539"><span class="hs-identifier hs-var">goCopy</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075543"><span class="hs-identifier hs-var">cs0</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075540"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span>    </span><span class="hs-comment">-- Copy the data</span><span>
</span><span id="line-312"></span><span>    </span><span id="local-6989586621679075539"><span class="annot"><span class="annottext">goCopy :: ByteString -&gt; Ptr Word8 -&gt; IO ()
</span><a href="#local-6989586621679075539"><span class="hs-identifier hs-var hs-var">goCopy</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>                        </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Ptr Word8
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-313"></span><span>    </span><span class="annot"><a href="#local-6989586621679075539"><span class="hs-identifier hs-var">goCopy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-type">S.PS</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>   </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>  </span><span class="hs-special">)</span><span> </span><span id="local-6989586621679075533"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075533"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679075532"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075532"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Ptr Word8 -&gt; IO ()
</span><a href="#local-6989586621679075539"><span class="hs-identifier hs-var">goCopy</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075533"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075532"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-314"></span><span>    </span><span class="annot"><a href="#local-6989586621679075539"><span class="hs-identifier hs-var">goCopy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-type">S.PS</span></a></span><span> </span><span id="local-6989586621679075531"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679075531"><span class="hs-identifier hs-var">fp</span></a></span></span><span> </span><span id="local-6989586621679075530"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075530"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679075529"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075529"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679075528"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075528"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679075527"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075527"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-315"></span><span>      </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/GHC.ForeignPtr.html#unsafeWithForeignPtr"><span class="hs-identifier hs-var">S.unsafeWithForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679075531"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO ()) -&gt; IO ()) -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679075525"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075525"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-316"></span><span>        </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Ptr Word8 -&gt; Int -&gt; IO ()
</span><a href="Data.ByteString.Internal.html#memcpy"><span class="hs-identifier hs-var">S.memcpy</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075527"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075525"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075530"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075529"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-317"></span><span>        </span><span class="annot"><span class="annottext">ByteString -&gt; Ptr Word8 -&gt; IO ()
</span><a href="#local-6989586621679075539"><span class="hs-identifier hs-var">goCopy</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075528"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075527"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075529"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-318"></span><span class="hs-comment">-- See the comment on Data.ByteString.Internal.concat for some background on</span><span>
</span><span id="line-319"></span><span class="hs-comment">-- this implementation.</span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-322"></span><span>
</span><span id="line-323"></span><span class="hs-comment">{-
-- | /O(n)/ Convert a '[a]' into a 'ByteString' using some
-- conversion function
packWith :: (a -&gt; Word8) -&gt; [a] -&gt; ByteString
packWith k str = LPS $ L.map (P.packWith k) (chunk defaultChunkSize str)
{-# INLINE packWith #-}
{-# SPECIALIZE packWith :: (Char -&gt; Word8) -&gt; [Char] -&gt; ByteString #-}

-- | /O(n)/ Converts a 'ByteString' to a '[a]', using a conversion function.
unpackWith :: (Word8 -&gt; a) -&gt; ByteString -&gt; [a]
unpackWith k (LPS ss) = L.concatMap (S.unpackWith k) ss
{-# INLINE unpackWith #-}
{-# SPECIALIZE unpackWith :: (Word8 -&gt; Char) -&gt; ByteString -&gt; [Char] #-}
-}</span><span>
</span><span id="line-337"></span><span>
</span><span id="line-338"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-339"></span><span class="hs-comment">-- Basic interface</span><span>
</span><span id="line-340"></span><span>
</span><span id="line-341"></span><span class="hs-comment">-- | /O(1)/ Test whether a ByteString is empty.</span><span>
</span><span id="line-342"></span><span class="annot"><a href="Data.ByteString.Lazy.html#null"><span class="hs-identifier hs-type">null</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-343"></span><span id="null"><span class="annot"><span class="annottext">null :: ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#null"><span class="hs-identifier hs-var hs-var">null</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-344"></span><span class="annot"><a href="Data.ByteString.Lazy.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-345"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#null"><span class="hs-pragma hs-type">null</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-346"></span><span>
</span><span id="line-347"></span><span class="hs-comment">-- | /O(c)/ 'length' returns the length of a ByteString as an 'Int64'</span><span>
</span><span id="line-348"></span><span class="annot"><a href="Data.ByteString.Lazy.html#length"><span class="hs-identifier hs-type">length</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-349"></span><span id="length"><span class="annot"><span class="annottext">length :: ByteString -&gt; Int64
</span><a href="Data.ByteString.Lazy.html#length"><span class="hs-identifier hs-var hs-var">length</span></a></span></span><span> </span><span id="local-6989586621679075522"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075522"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int64 -&gt; ByteString -&gt; Int64) -&gt; Int64 -&gt; ByteString -&gt; Int64
forall a. (a -&gt; ByteString -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldlChunks"><span class="hs-identifier hs-var">foldlChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679075521"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075521"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679075520"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075520"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075521"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075520"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075522"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-350"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-351"></span><span>
</span><span id="line-352"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">5</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#cons"><span class="hs-operator hs-type">`cons`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#cons%27"><span class="hs-operator hs-type">`cons'`</span></a></span><span> </span><span class="hs-comment">--same as list (:)</span><span>
</span><span id="line-353"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">5</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#snoc"><span class="hs-operator hs-type">`snoc`</span></a></span><span>
</span><span id="line-354"></span><span>
</span><span id="line-355"></span><span class="hs-comment">-- | /O(1)/ 'cons' is analogous to '(Prelude.:)' for lists.</span><span>
</span><span id="line-356"></span><span class="hs-comment">--</span><span>
</span><span id="line-357"></span><span class="annot"><a href="Data.ByteString.Lazy.html#cons"><span class="hs-identifier hs-type">cons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-358"></span><span id="cons"><span class="annot"><span class="annottext">cons :: Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#cons"><span class="hs-identifier hs-var hs-var">cons</span></a></span></span><span> </span><span id="local-6989586621679075518"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075518"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075517"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075517"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#singleton"><span class="hs-identifier hs-var">S.singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075518"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075517"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-359"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#cons"><span class="hs-pragma hs-type">cons</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span class="hs-comment">-- | /O(1)/ Unlike 'cons', 'cons'' is</span><span>
</span><span id="line-362"></span><span class="hs-comment">-- strict in the ByteString that we are consing onto. More precisely, it forces</span><span>
</span><span id="line-363"></span><span class="hs-comment">-- the head and the first chunk. It does this because, for space efficiency, it</span><span>
</span><span id="line-364"></span><span class="hs-comment">-- may coalesce the new byte onto the first \'chunk\' rather than starting a</span><span>
</span><span id="line-365"></span><span class="hs-comment">-- new \'chunk\'.</span><span>
</span><span id="line-366"></span><span class="hs-comment">--</span><span>
</span><span id="line-367"></span><span class="hs-comment">-- So that means you can't use a lazy recursive contruction like this:</span><span>
</span><span id="line-368"></span><span class="hs-comment">--</span><span>
</span><span id="line-369"></span><span class="hs-comment">-- &gt; let xs = cons' c xs in xs</span><span>
</span><span id="line-370"></span><span class="hs-comment">--</span><span>
</span><span id="line-371"></span><span class="hs-comment">-- You can however use 'cons', as well as 'repeat' and 'cycle', to build</span><span>
</span><span id="line-372"></span><span class="hs-comment">-- infinite lazy ByteStrings.</span><span>
</span><span id="line-373"></span><span class="hs-comment">--</span><span>
</span><span id="line-374"></span><span class="annot"><a href="Data.ByteString.Lazy.html#cons%27"><span class="hs-identifier hs-type">cons'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-375"></span><span id="cons%27"><span class="annot"><span class="annottext">cons' :: Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#cons%27"><span class="hs-identifier hs-var hs-var">cons'</span></a></span></span><span> </span><span id="local-6989586621679075516"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075516"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075515"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075515"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075514"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075514"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075515"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">16</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#cons"><span class="hs-identifier hs-var">S.cons</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075516"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075515"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075514"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-376"></span><span class="annot"><a href="Data.ByteString.Lazy.html#cons%27"><span class="hs-identifier hs-var">cons'</span></a></span><span> </span><span id="local-6989586621679075511"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075511"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679075510"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075510"><span class="hs-identifier hs-var">cs</span></a></span></span><span>                             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#singleton"><span class="hs-identifier hs-var">S.singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075511"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075510"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-377"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#cons%27"><span class="hs-pragma hs-type">cons'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-378"></span><span>
</span><span id="line-379"></span><span class="hs-comment">-- | /O(n\/c)/ Append a byte to the end of a 'ByteString'</span><span>
</span><span id="line-380"></span><span class="annot"><a href="Data.ByteString.Lazy.html#snoc"><span class="hs-identifier hs-type">snoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-381"></span><span id="snoc"><span class="annot"><span class="annottext">snoc :: ByteString -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#snoc"><span class="hs-identifier hs-var hs-var">snoc</span></a></span></span><span> </span><span id="local-6989586621679075509"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075509"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span id="local-6989586621679075508"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075508"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; ByteString -&gt; ByteString -&gt; ByteString
forall a. (ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier hs-var">foldrChunks</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075508"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075509"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-382"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#snoc"><span class="hs-pragma hs-type">snoc</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-383"></span><span>
</span><span id="line-384"></span><span class="hs-comment">-- | /O(1)/ Extract the first element of a ByteString, which must be non-empty.</span><span>
</span><span id="line-385"></span><span class="annot"><a href="Data.ByteString.Lazy.html#head"><span class="hs-identifier hs-type">head</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-386"></span><span id="head"><span class="annot"><span class="annottext">head :: ByteString -&gt; Word8
</span><a href="Data.ByteString.Lazy.html#head"><span class="hs-identifier hs-var hs-var">head</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Word8
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;head&quot;</span></span><span>
</span><span id="line-387"></span><span class="annot"><a href="Data.ByteString.Lazy.html#head"><span class="hs-identifier hs-var">head</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075506"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075506"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075506"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-388"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#head"><span class="hs-pragma hs-type">head</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-389"></span><span>
</span><span id="line-390"></span><span class="hs-comment">-- | /O(1)/ Extract the head and tail of a ByteString, returning Nothing</span><span>
</span><span id="line-391"></span><span class="hs-comment">-- if it is empty.</span><span>
</span><span id="line-392"></span><span class="annot"><a href="Data.ByteString.Lazy.html#uncons"><span class="hs-identifier hs-type">uncons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-393"></span><span id="uncons"><span class="annot"><span class="annottext">uncons :: ByteString -&gt; Maybe (Word8, ByteString)
</span><a href="Data.ByteString.Lazy.html#uncons"><span class="hs-identifier hs-var hs-var">uncons</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Word8, ByteString)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-394"></span><span class="annot"><a href="Data.ByteString.Lazy.html#uncons"><span class="hs-identifier hs-var">uncons</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075504"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075504"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075503"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075503"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-395"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8, ByteString) -&gt; Maybe (Word8, ByteString)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075504"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-396"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075504"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075503"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075504"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075503"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-397"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#uncons"><span class="hs-pragma hs-type">uncons</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-398"></span><span>
</span><span id="line-399"></span><span class="hs-comment">-- | /O(1)/ Extract the elements after the head of a ByteString, which must be</span><span>
</span><span id="line-400"></span><span class="hs-comment">-- non-empty.</span><span>
</span><span id="line-401"></span><span class="annot"><a href="Data.ByteString.Lazy.html#tail"><span class="hs-identifier hs-type">tail</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-402"></span><span id="tail"><span class="annot"><span class="annottext">tail :: ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#tail"><span class="hs-identifier hs-var hs-var">tail</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; ByteString
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tail&quot;</span></span><span>
</span><span id="line-403"></span><span class="annot"><a href="Data.ByteString.Lazy.html#tail"><span class="hs-identifier hs-var">tail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075501"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075501"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075500"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075500"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-404"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075501"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075500"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-405"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075501"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075500"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-406"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#tail"><span class="hs-pragma hs-type">tail</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-407"></span><span>
</span><span id="line-408"></span><span class="hs-comment">-- | /O(n\/c)/ Extract the last element of a ByteString, which must be finite</span><span>
</span><span id="line-409"></span><span class="hs-comment">-- and non-empty.</span><span>
</span><span id="line-410"></span><span class="annot"><a href="Data.ByteString.Lazy.html#last"><span class="hs-identifier hs-type">last</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-411"></span><span id="last"><span class="annot"><span class="annottext">last :: ByteString -&gt; Word8
</span><a href="Data.ByteString.Lazy.html#last"><span class="hs-identifier hs-var hs-var">last</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Word8
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;last&quot;</span></span><span>
</span><span id="line-412"></span><span class="annot"><a href="Data.ByteString.Lazy.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075499"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075499"><span class="hs-identifier hs-var">c0</span></a></span></span><span> </span><span id="local-6989586621679075498"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075498"><span class="hs-identifier hs-var">cs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Word8
</span><a href="#local-6989586621679075497"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075499"><span class="hs-identifier hs-var">c0</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075498"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-413"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075497"><span class="annot"><span class="annottext">go :: ByteString -&gt; ByteString -&gt; Word8
</span><a href="#local-6989586621679075497"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679075496"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075496"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeLast"><span class="hs-identifier hs-var">S.unsafeLast</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075496"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-414"></span><span>        </span><span class="annot"><a href="#local-6989586621679075497"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075494"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075494"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075493"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075493"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Word8
</span><a href="#local-6989586621679075497"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075494"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075493"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-415"></span><span class="hs-comment">-- XXX Don't inline this. Something breaks with 6.8.2 (haven't investigated yet)</span><span>
</span><span id="line-416"></span><span>
</span><span id="line-417"></span><span class="hs-comment">-- | /O(n\/c)/ Return all the elements of a 'ByteString' except the last one.</span><span>
</span><span id="line-418"></span><span class="annot"><a href="Data.ByteString.Lazy.html#init"><span class="hs-identifier hs-type">init</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-419"></span><span id="init"><span class="annot"><span class="annottext">init :: ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#init"><span class="hs-identifier hs-var hs-var">init</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; ByteString
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;init&quot;</span></span><span>
</span><span id="line-420"></span><span class="annot"><a href="Data.ByteString.Lazy.html#init"><span class="hs-identifier hs-var">init</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075492"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075492"><span class="hs-identifier hs-var">c0</span></a></span></span><span> </span><span id="local-6989586621679075491"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075491"><span class="hs-identifier hs-var">cs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075490"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075492"><span class="hs-identifier hs-var">c0</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075491"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-421"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075490"><span class="annot"><span class="annottext">go :: ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075490"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679075487"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075487"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075487"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-422"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeInit"><span class="hs-identifier hs-var">S.unsafeInit</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075487"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-423"></span><span>        </span><span class="annot"><a href="#local-6989586621679075490"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679075485"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075485"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075484"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075484"><span class="hs-identifier hs-var">c'</span></a></span></span><span> </span><span id="local-6989586621679075483"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075483"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075485"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075490"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075484"><span class="hs-identifier hs-var">c'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075483"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-424"></span><span>
</span><span id="line-425"></span><span class="hs-comment">-- | /O(n\/c)/ Extract the 'init' and 'last' of a ByteString, returning Nothing</span><span>
</span><span id="line-426"></span><span class="hs-comment">-- if it is empty.</span><span>
</span><span id="line-427"></span><span class="hs-comment">--</span><span>
</span><span id="line-428"></span><span class="hs-comment">-- * It is no faster than using 'init' and 'last'</span><span>
</span><span id="line-429"></span><span class="annot"><a href="Data.ByteString.Lazy.html#unsnoc"><span class="hs-identifier hs-type">unsnoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-430"></span><span id="unsnoc"><span class="annot"><span class="annottext">unsnoc :: ByteString -&gt; Maybe (ByteString, Word8)
</span><a href="Data.ByteString.Lazy.html#unsnoc"><span class="hs-identifier hs-var hs-var">unsnoc</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (ByteString, Word8)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-431"></span><span class="annot"><a href="Data.ByteString.Lazy.html#unsnoc"><span class="hs-identifier hs-var">unsnoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075482"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075482"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075481"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075481"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString, Word8) -&gt; Maybe (ByteString, Word8)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#init"><span class="hs-identifier hs-var">init</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075482"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075481"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Lazy.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075482"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075481"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-432"></span><span>
</span><span id="line-433"></span><span class="hs-comment">-- | /O(n\/c)/ Append two ByteStrings</span><span>
</span><span id="line-434"></span><span class="annot"><a href="Data.ByteString.Lazy.html#append"><span class="hs-identifier hs-type">append</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-435"></span><span id="append"><span class="annot"><span class="annottext">append :: ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#append"><span class="hs-identifier hs-var hs-var">append</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-identifier hs-var">mappend</span></a></span><span>
</span><span id="line-436"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-437"></span><span>
</span><span id="line-438"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-439"></span><span class="hs-comment">-- Transformations</span><span>
</span><span id="line-440"></span><span>
</span><span id="line-441"></span><span class="hs-comment">-- | /O(n)/ 'map' @f xs@ is the ByteString obtained by applying @f@ to each</span><span>
</span><span id="line-442"></span><span class="hs-comment">-- element of @xs@.</span><span>
</span><span id="line-443"></span><span class="annot"><a href="Data.ByteString.Lazy.html#map"><span class="hs-identifier hs-type">map</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-444"></span><span id="map"><span class="annot"><span class="annottext">map :: (Word8 -&gt; Word8) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#map"><span class="hs-identifier hs-var hs-var">map</span></a></span></span><span> </span><span id="local-6989586621679075480"><span class="annot"><span class="annottext">Word8 -&gt; Word8
</span><a href="#local-6989586621679075480"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075479"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075479"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679075478"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075479"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-445"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-446"></span><span>        </span><span id="local-6989586621679075478"><span class="annot"><span class="annottext">go :: ByteString -&gt; ByteString
</span><a href="#local-6989586621679075478"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-447"></span><span>        </span><span class="annot"><a href="#local-6989586621679075478"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075477"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075477"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679075476"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075476"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075475"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075474"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-448"></span><span>            </span><span class="hs-keyword">where</span><span>
</span><span id="line-449"></span><span>                </span><span id="local-6989586621679075475"><span class="annot"><span class="annottext">y :: ByteString
</span><a href="#local-6989586621679075475"><span class="hs-identifier hs-var hs-var">y</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#map"><span class="hs-identifier hs-var">S.map</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8
</span><a href="#local-6989586621679075480"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075477"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-450"></span><span>                </span><span id="local-6989586621679075474"><span class="annot"><span class="annottext">ys :: ByteString
</span><a href="#local-6989586621679075474"><span class="hs-identifier hs-var hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679075478"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075476"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-451"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-452"></span><span>
</span><span id="line-453"></span><span class="hs-comment">-- | /O(n)/ 'reverse' @xs@ returns the elements of @xs@ in reverse order.</span><span>
</span><span id="line-454"></span><span class="annot"><a href="Data.ByteString.Lazy.html#reverse"><span class="hs-identifier hs-type">reverse</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-455"></span><span id="reverse"><span class="annot"><span class="annottext">reverse :: ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#reverse"><span class="hs-identifier hs-var hs-var">reverse</span></a></span></span><span> </span><span id="local-6989586621679075472"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075472"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075471"><span class="hs-identifier hs-var">rev</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075472"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-456"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075471"><span class="annot"><span class="annottext">rev :: ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075471"><span class="hs-identifier hs-var hs-var">rev</span></a></span></span><span> </span><span id="local-6989586621679075470"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075470"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075470"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-457"></span><span>        </span><span class="annot"><a href="#local-6989586621679075471"><span class="hs-identifier hs-var">rev</span></a></span><span> </span><span id="local-6989586621679075469"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075469"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075468"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075468"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075467"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075467"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075471"><span class="hs-identifier hs-var">rev</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#reverse"><span class="hs-identifier hs-var">S.reverse</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075468"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075469"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075467"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-458"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#reverse"><span class="hs-pragma hs-type">reverse</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-459"></span><span>
</span><span id="line-460"></span><span class="hs-comment">-- | The 'intersperse' function takes a 'Word8' and a 'ByteString' and</span><span>
</span><span id="line-461"></span><span class="hs-comment">-- \`intersperses\' that byte between the elements of the 'ByteString'.</span><span>
</span><span id="line-462"></span><span class="hs-comment">-- It is analogous to the intersperse function on Lists.</span><span>
</span><span id="line-463"></span><span class="annot"><a href="Data.ByteString.Lazy.html#intersperse"><span class="hs-identifier hs-type">intersperse</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-464"></span><span id="intersperse"><span class="annot"><span class="annottext">intersperse :: Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#intersperse"><span class="hs-identifier hs-var hs-var">intersperse</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-465"></span><span class="annot"><a href="Data.ByteString.Lazy.html#intersperse"><span class="hs-identifier hs-var">intersperse</span></a></span><span> </span><span id="local-6989586621679075465"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075465"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075464"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075464"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075463"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075463"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#intersperse"><span class="hs-identifier hs-var">S.intersperse</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075465"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075464"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-466"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; ByteString -&gt; ByteString -&gt; ByteString
forall a. (ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier hs-var">foldrChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; (ByteString -&gt; ByteString)
-&gt; ByteString
-&gt; ByteString
-&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679075460"><span class="hs-identifier hs-var">intersperse'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075463"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-467"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="#local-6989586621679075460"><span class="hs-identifier hs-type">intersperse'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span>
</span><span id="line-468"></span><span>        </span><span id="local-6989586621679075460"><span class="annot"><span class="annottext">intersperse' :: ByteString -&gt; ByteString
</span><a href="#local-6989586621679075460"><span class="hs-identifier hs-var hs-var">intersperse'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-type">S.PS</span></a></span><span> </span><span id="local-6989586621679075459"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679075459"><span class="hs-identifier hs-var">fp</span></a></span></span><span> </span><span id="local-6989586621679075458"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075458"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span id="local-6989586621679075457"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075457"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-469"></span><span>          </span><span class="annot"><span class="annottext">Int -&gt; (Ptr Word8 -&gt; IO ()) -&gt; ByteString
</span><a href="Data.ByteString.Internal.html#unsafeCreate"><span class="hs-identifier hs-var">S.unsafeCreate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075457"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO ()) -&gt; ByteString)
-&gt; (Ptr Word8 -&gt; IO ()) -&gt; ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679075455"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075455"><span class="hs-identifier hs-var">p'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/GHC.ForeignPtr.html#unsafeWithForeignPtr"><span class="hs-identifier hs-var">S.unsafeWithForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679075459"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO ()) -&gt; IO ()) -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679075454"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075454"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-470"></span><span>            </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Word8 -&gt; IO ()
forall a. Storable a =&gt; Ptr a -&gt; a -&gt; IO ()
</span><a href="../../base/src/Foreign.Storable.html#poke"><span class="hs-identifier hs-var">poke</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075455"><span class="hs-identifier hs-var">p'</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075465"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-471"></span><span>            </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Ptr Word8 -&gt; CULong -&gt; Word8 -&gt; IO ()
</span><a href="Data.ByteString.Internal.html#c_intersperse"><span class="hs-identifier hs-var">S.c_intersperse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075455"><span class="hs-identifier hs-var">p'</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679075454"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075458"><span class="hs-identifier hs-var">o</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; CULong
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075457"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075465"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-472"></span><span>
</span><span id="line-473"></span><span class="hs-comment">-- | The 'transpose' function transposes the rows and columns of its</span><span>
</span><span id="line-474"></span><span class="hs-comment">-- 'ByteString' argument.</span><span>
</span><span id="line-475"></span><span class="annot"><a href="Data.ByteString.Lazy.html#transpose"><span class="hs-identifier hs-type">transpose</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-476"></span><span id="transpose"><span class="annot"><span class="annottext">transpose :: [ByteString] -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#transpose"><span class="hs-identifier hs-var hs-var">transpose</span></a></span></span><span> </span><span id="local-6989586621679075451"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075451"><span class="hs-identifier hs-var">css</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Word8] -&gt; ByteString) -&gt; [[Word8]] -&gt; [ByteString]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679075450"><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679075450"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Word8] -&gt; ByteString
</span><a href="Data.ByteString.html#pack"><span class="hs-identifier hs-var">S.pack</span></a></span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679075450"><span class="hs-identifier hs-var">ss</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-477"></span><span>                      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Word8]] -&gt; [[Word8]]
forall a. [[a]] -&gt; [[a]]
</span><a href="../../base/src/Data.OldList.html#transpose"><span class="hs-identifier hs-var">L.transpose</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ByteString -&gt; [Word8]) -&gt; [ByteString] -&gt; [[Word8]]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [Word8]
</span><a href="Data.ByteString.Lazy.html#unpack"><span class="hs-identifier hs-var">unpack</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075451"><span class="hs-identifier hs-var">css</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-478"></span><span class="hs-comment">--TODO: make this fast</span><span>
</span><span id="line-479"></span><span>
</span><span id="line-480"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-481"></span><span class="hs-comment">-- Reducing 'ByteString's</span><span>
</span><span id="line-482"></span><span>
</span><span id="line-483"></span><span class="hs-comment">-- | 'foldl', applied to a binary operator, a starting value (typically</span><span>
</span><span id="line-484"></span><span class="hs-comment">-- the left-identity of the operator), and a ByteString, reduces the</span><span>
</span><span id="line-485"></span><span class="hs-comment">-- ByteString using the binary operator, from left to right.</span><span>
</span><span id="line-486"></span><span id="local-6989586621679075917"><span class="annot"><a href="Data.ByteString.Lazy.html#foldl"><span class="hs-identifier hs-type">foldl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679075917"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075917"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075917"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075917"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-487"></span><span id="foldl"><span class="annot"><span class="annottext">foldl :: forall a. (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.html#foldl"><span class="hs-identifier hs-var hs-var">foldl</span></a></span></span><span> </span><span id="local-6989586621679075447"><span class="annot"><span class="annottext">a -&gt; Word8 -&gt; a
</span><a href="#local-6989586621679075447"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075446"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075446"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; ByteString -&gt; a
</span><a href="#local-6989586621679075445"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075446"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-488"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075445"><span class="annot"><span class="annottext">go :: a -&gt; ByteString -&gt; a
</span><a href="#local-6989586621679075445"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679075444"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075444"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075444"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-489"></span><span>        </span><span class="annot"><a href="#local-6989586621679075445"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679075443"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075443"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075442"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075442"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075441"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075441"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; ByteString -&gt; a
</span><a href="#local-6989586621679075445"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
forall a. (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.html#foldl"><span class="hs-identifier hs-var">S.foldl</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Word8 -&gt; a
</span><a href="#local-6989586621679075447"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075443"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075442"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075441"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-490"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl"><span class="hs-pragma hs-type">foldl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-491"></span><span>
</span><span id="line-492"></span><span class="hs-comment">-- | 'foldl'' is like 'foldl', but strict in the accumulator.</span><span>
</span><span id="line-493"></span><span id="local-6989586621679075439"><span class="annot"><a href="Data.ByteString.Lazy.html#foldl%27"><span class="hs-identifier hs-type">foldl'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679075439"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075439"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075439"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075439"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-494"></span><span id="foldl%27"><span class="annot"><span class="annottext">foldl' :: forall a. (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.html#foldl%27"><span class="hs-identifier hs-var hs-var">foldl'</span></a></span></span><span> </span><span id="local-6989586621679075438"><span class="annot"><span class="annottext">a -&gt; Word8 -&gt; a
</span><a href="#local-6989586621679075438"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075437"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075437"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; ByteString -&gt; a
</span><a href="#local-6989586621679075436"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075437"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-495"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075436"><span class="annot"><span class="annottext">go :: a -&gt; ByteString -&gt; a
</span><a href="#local-6989586621679075436"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679075435"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075435"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075435"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-496"></span><span>        </span><span class="annot"><a href="#local-6989586621679075436"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679075434"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075434"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075433"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075433"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075432"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075432"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; ByteString -&gt; a
</span><a href="#local-6989586621679075436"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
forall a. (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.html#foldl%27"><span class="hs-identifier hs-var">S.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Word8 -&gt; a
</span><a href="#local-6989586621679075438"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075434"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075433"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075432"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-497"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl%27"><span class="hs-pragma hs-type">foldl'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-498"></span><span>
</span><span id="line-499"></span><span class="hs-comment">-- | 'foldr', applied to a binary operator, a starting value</span><span>
</span><span id="line-500"></span><span class="hs-comment">-- (typically the right-identity of the operator), and a ByteString,</span><span>
</span><span id="line-501"></span><span class="hs-comment">-- reduces the ByteString using the binary operator, from right to left.</span><span>
</span><span id="line-502"></span><span id="local-6989586621679075913"><span class="annot"><a href="Data.ByteString.Lazy.html#foldr"><span class="hs-identifier hs-type">foldr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075913"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075913"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075913"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075913"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-503"></span><span id="foldr"><span class="annot"><span class="annottext">foldr :: forall a. (Word8 -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.html#foldr"><span class="hs-identifier hs-var hs-var">foldr</span></a></span></span><span> </span><span id="local-6989586621679075430"><span class="annot"><span class="annottext">Word8 -&gt; a -&gt; a
</span><a href="#local-6989586621679075430"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679075429"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075429"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
forall a. (ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier hs-var">foldrChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; ByteString -&gt; a) -&gt; ByteString -&gt; a -&gt; a
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Word8 -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
forall a. (Word8 -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.html#foldr"><span class="hs-identifier hs-var">S.foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; a -&gt; a
</span><a href="#local-6989586621679075430"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075429"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-504"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-505"></span><span>
</span><span id="line-506"></span><span class="hs-comment">-- | 'foldl1' is a variant of 'foldl' that has no starting value</span><span>
</span><span id="line-507"></span><span class="hs-comment">-- argument, and thus must be applied to non-empty 'ByteString's.</span><span>
</span><span id="line-508"></span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl1"><span class="hs-identifier hs-type">foldl1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-509"></span><span id="foldl1"><span class="annot"><span class="annottext">foldl1 :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8
</span><a href="Data.ByteString.Lazy.html#foldl1"><span class="hs-identifier hs-var hs-var">foldl1</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Word8
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;foldl1&quot;</span></span><span>
</span><span id="line-510"></span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl1"><span class="hs-identifier hs-var">foldl1</span></a></span><span> </span><span id="local-6989586621679075426"><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><a href="#local-6989586621679075426"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075425"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075425"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075424"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075424"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; Word8
forall a. (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><a href="#local-6989586621679075426"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075425"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075425"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075424"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-511"></span><span>
</span><span id="line-512"></span><span class="hs-comment">-- | 'foldl1'' is like 'foldl1', but strict in the accumulator.</span><span>
</span><span id="line-513"></span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl1%27"><span class="hs-identifier hs-type">foldl1'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-514"></span><span id="foldl1%27"><span class="annot"><span class="annottext">foldl1' :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8
</span><a href="Data.ByteString.Lazy.html#foldl1%27"><span class="hs-identifier hs-var hs-var">foldl1'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Word8
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;foldl1'&quot;</span></span><span>
</span><span id="line-515"></span><span class="annot"><a href="Data.ByteString.Lazy.html#foldl1%27"><span class="hs-identifier hs-var">foldl1'</span></a></span><span> </span><span id="local-6989586621679075423"><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><a href="#local-6989586621679075423"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075422"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075422"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075421"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075421"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; Word8
forall a. (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><a href="#local-6989586621679075423"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075422"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075422"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075421"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-516"></span><span>
</span><span id="line-517"></span><span class="hs-comment">-- | 'foldr1' is a variant of 'foldr' that has no starting value argument,</span><span>
</span><span id="line-518"></span><span class="hs-comment">-- and thus must be applied to non-empty 'ByteString's</span><span>
</span><span id="line-519"></span><span class="annot"><a href="Data.ByteString.Lazy.html#foldr1"><span class="hs-identifier hs-type">foldr1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-520"></span><span id="foldr1"><span class="annot"><span class="annottext">foldr1 :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8
</span><a href="Data.ByteString.Lazy.html#foldr1"><span class="hs-identifier hs-var hs-var">foldr1</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Word8
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;foldr1&quot;</span></span><span>
</span><span id="line-521"></span><span class="annot"><a href="Data.ByteString.Lazy.html#foldr1"><span class="hs-identifier hs-var">foldr1</span></a></span><span> </span><span id="local-6989586621679075420"><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><a href="#local-6989586621679075420"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075419"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075419"><span class="hs-identifier hs-var">c0</span></a></span></span><span> </span><span id="local-6989586621679075418"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075418"><span class="hs-identifier hs-var">cs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Word8
</span><a href="#local-6989586621679075417"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075419"><span class="hs-identifier hs-var">c0</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075418"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-522"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075417"><span class="annot"><span class="annottext">go :: ByteString -&gt; ByteString -&gt; Word8
</span><a href="#local-6989586621679075417"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679075416"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075416"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8
</span><a href="Data.ByteString.html#foldr1"><span class="hs-identifier hs-var">S.foldr1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><a href="#local-6989586621679075420"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075416"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-523"></span><span>        </span><span class="annot"><a href="#local-6989586621679075417"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679075414"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075414"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075413"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075413"><span class="hs-identifier hs-var">c'</span></a></span></span><span> </span><span id="local-6989586621679075412"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075412"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; Word8
forall a. (Word8 -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.html#foldr"><span class="hs-identifier hs-var">S.foldr</span></a></span><span>  </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><a href="#local-6989586621679075420"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Word8
</span><a href="#local-6989586621679075417"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075413"><span class="hs-identifier hs-var">c'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075412"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075414"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-524"></span><span>
</span><span id="line-525"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-526"></span><span class="hs-comment">-- Special folds</span><span>
</span><span id="line-527"></span><span>
</span><span id="line-528"></span><span class="hs-comment">-- | /O(n)/ Concatenate a list of ByteStrings.</span><span>
</span><span id="line-529"></span><span class="annot"><a href="Data.ByteString.Lazy.html#concat"><span class="hs-identifier hs-type">concat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-530"></span><span id="concat"><span class="annot"><span class="annottext">concat :: [ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#concat"><span class="hs-identifier hs-var hs-var">concat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
forall a. Monoid a =&gt; [a] -&gt; a
</span><a href="../../base/src/GHC.Base.html#mconcat"><span class="hs-identifier hs-var">mconcat</span></a></span><span>
</span><span id="line-531"></span><span>
</span><span id="line-532"></span><span class="hs-comment">-- | Map a function over a 'ByteString' and concatenate the results</span><span>
</span><span id="line-533"></span><span class="annot"><a href="Data.ByteString.Lazy.html#concatMap"><span class="hs-identifier hs-type">concatMap</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-534"></span><span id="concatMap"><span class="annot"><span class="annottext">concatMap :: (Word8 -&gt; ByteString) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#concatMap"><span class="hs-identifier hs-var hs-var">concatMap</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-535"></span><span class="annot"><a href="Data.ByteString.Lazy.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span id="local-6989586621679075411"><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="#local-6989586621679075411"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075410"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075410"><span class="hs-identifier hs-var">c0</span></a></span></span><span> </span><span id="local-6989586621679075409"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075409"><span class="hs-identifier hs-var">cs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075408"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075410"><span class="hs-identifier hs-var">c0</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075409"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-536"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-537"></span><span>    </span><span class="annot"><a href="#local-6989586621679075407"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-538"></span><span>    </span><span id="local-6989586621679075407"><span class="annot"><span class="annottext">go :: ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075407"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span id="local-6989586621679075406"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075406"><span class="hs-identifier hs-var">c'</span></a></span></span><span> </span><span id="local-6989586621679075405"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075405"><span class="hs-identifier hs-var">cs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075408"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075406"><span class="hs-identifier hs-var">c'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075405"><span class="hs-identifier hs-var">cs'</span></a></span><span>
</span><span id="line-539"></span><span>    </span><span class="annot"><a href="#local-6989586621679075407"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075404"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075404"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075403"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075403"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679075402"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075402"><span class="hs-identifier hs-var">c'</span></a></span></span><span> </span><span id="local-6989586621679075401"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075401"><span class="hs-identifier hs-var">cs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075404"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075407"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075403"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075402"><span class="hs-identifier hs-var">c'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075401"><span class="hs-identifier hs-var">cs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-540"></span><span>
</span><span id="line-541"></span><span>    </span><span class="annot"><a href="#local-6989586621679075408"><span class="hs-identifier hs-type">to</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-542"></span><span>    </span><span id="local-6989586621679075408"><span class="annot"><span class="annottext">to :: ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075408"><span class="hs-identifier hs-var hs-var">to</span></a></span></span><span> </span><span id="local-6989586621679075400"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075400"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075399"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075399"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075400"><span class="hs-identifier hs-var">c</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075399"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-543"></span><span>        </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-544"></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075398"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075398"><span class="hs-identifier hs-var">c'</span></a></span></span><span> </span><span id="local-6989586621679075397"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075397"><span class="hs-identifier hs-var">cs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075408"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075398"><span class="hs-identifier hs-var">c'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075397"><span class="hs-identifier hs-var">cs'</span></a></span><span>
</span><span id="line-545"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075407"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="#local-6989586621679075411"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075400"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075400"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075399"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-546"></span><span>
</span><span id="line-547"></span><span class="hs-comment">-- | /O(n)/ Applied to a predicate and a ByteString, 'any' determines if</span><span>
</span><span id="line-548"></span><span class="hs-comment">-- any element of the 'ByteString' satisfies the predicate.</span><span>
</span><span id="line-549"></span><span class="annot"><a href="Data.ByteString.Lazy.html#any"><span class="hs-identifier hs-type">any</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-550"></span><span id="any"><span class="annot"><span class="annottext">any :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#any"><span class="hs-identifier hs-var hs-var">any</span></a></span></span><span> </span><span id="local-6989586621679075396"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075396"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075395"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075395"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; Bool -&gt; Bool) -&gt; Bool -&gt; ByteString -&gt; Bool
forall a. (ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier hs-var">foldrChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679075394"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075394"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075393"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679075393"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.html#any"><span class="hs-identifier hs-var">S.any</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075396"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075394"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679075393"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075395"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-551"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#any"><span class="hs-pragma hs-type">any</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-552"></span><span class="hs-comment">-- todo fuse</span><span>
</span><span id="line-553"></span><span>
</span><span id="line-554"></span><span class="hs-comment">-- | /O(n)/ Applied to a predicate and a 'ByteString', 'all' determines</span><span>
</span><span id="line-555"></span><span class="hs-comment">-- if all elements of the 'ByteString' satisfy the predicate.</span><span>
</span><span id="line-556"></span><span class="annot"><a href="Data.ByteString.Lazy.html#all"><span class="hs-identifier hs-type">all</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-557"></span><span id="all"><span class="annot"><span class="annottext">all :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#all"><span class="hs-identifier hs-var hs-var">all</span></a></span></span><span> </span><span id="local-6989586621679075390"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075390"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075389"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075389"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; Bool -&gt; Bool) -&gt; Bool -&gt; ByteString -&gt; Bool
forall a. (ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier hs-var">foldrChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679075388"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075388"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075387"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679075387"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.html#all"><span class="hs-identifier hs-var">S.all</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075390"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075388"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679075387"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075389"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-558"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#all"><span class="hs-pragma hs-type">all</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-559"></span><span class="hs-comment">-- todo fuse</span><span>
</span><span id="line-560"></span><span>
</span><span id="line-561"></span><span class="hs-comment">-- | /O(n)/ 'maximum' returns the maximum value from a 'ByteString'</span><span>
</span><span id="line-562"></span><span class="annot"><a href="Data.ByteString.Lazy.html#maximum"><span class="hs-identifier hs-type">maximum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-563"></span><span id="maximum"><span class="annot"><span class="annottext">maximum :: ByteString -&gt; Word8
</span><a href="Data.ByteString.Lazy.html#maximum"><span class="hs-identifier hs-var hs-var">maximum</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Word8
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;maximum&quot;</span></span><span>
</span><span id="line-564"></span><span class="annot"><a href="Data.ByteString.Lazy.html#maximum"><span class="hs-identifier hs-var">maximum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075384"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075384"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075383"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075383"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; Word8
forall a. (a -&gt; ByteString -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldlChunks"><span class="hs-identifier hs-var">foldlChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679075382"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075382"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679075381"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075381"><span class="hs-identifier hs-var">c'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075382"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><a href="../../ghc-prim/src/GHC.Classes.html#max"><span class="hs-operator hs-var">`max`</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.html#maximum"><span class="hs-identifier hs-var">S.maximum</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075381"><span class="hs-identifier hs-var">c'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-565"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.html#maximum"><span class="hs-identifier hs-var">S.maximum</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075384"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075383"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-566"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#maximum"><span class="hs-pragma hs-type">maximum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-567"></span><span>
</span><span id="line-568"></span><span class="hs-comment">-- | /O(n)/ 'minimum' returns the minimum value from a 'ByteString'</span><span>
</span><span id="line-569"></span><span class="annot"><a href="Data.ByteString.Lazy.html#minimum"><span class="hs-identifier hs-type">minimum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-570"></span><span id="minimum"><span class="annot"><span class="annottext">minimum :: ByteString -&gt; Word8
</span><a href="Data.ByteString.Lazy.html#minimum"><span class="hs-identifier hs-var hs-var">minimum</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Word8
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;minimum&quot;</span></span><span>
</span><span id="line-571"></span><span class="annot"><a href="Data.ByteString.Lazy.html#minimum"><span class="hs-identifier hs-var">minimum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075378"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075378"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075377"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075377"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; Word8
forall a. (a -&gt; ByteString -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldlChunks"><span class="hs-identifier hs-var">foldlChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679075376"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075376"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679075375"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075375"><span class="hs-identifier hs-var">c'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075376"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><a href="../../ghc-prim/src/GHC.Classes.html#min"><span class="hs-operator hs-var">`min`</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.html#minimum"><span class="hs-identifier hs-var">S.minimum</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075375"><span class="hs-identifier hs-var">c'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-572"></span><span>                                     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.html#minimum"><span class="hs-identifier hs-var">S.minimum</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075378"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075377"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-573"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#minimum"><span class="hs-pragma hs-type">minimum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-574"></span><span>
</span><span id="line-575"></span><span class="hs-comment">-- | The 'mapAccumL' function behaves like a combination of 'map' and</span><span>
</span><span id="line-576"></span><span class="hs-comment">-- 'foldl'; it applies a function to each element of a ByteString,</span><span>
</span><span id="line-577"></span><span class="hs-comment">-- passing an accumulating parameter from left to right, and returning a</span><span>
</span><span id="line-578"></span><span class="hs-comment">-- final value of this accumulator together with the new ByteString.</span><span>
</span><span id="line-579"></span><span id="local-6989586621679075907"><span class="annot"><a href="Data.ByteString.Lazy.html#mapAccumL"><span class="hs-identifier hs-type">mapAccumL</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679075907"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679075907"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075907"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679075907"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-580"></span><span id="mapAccumL"><span class="annot"><span class="annottext">mapAccumL :: forall acc.
(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="Data.ByteString.Lazy.html#mapAccumL"><span class="hs-identifier hs-var hs-var">mapAccumL</span></a></span></span><span> </span><span id="local-6989586621679075372"><span class="annot"><span class="annottext">acc -&gt; Word8 -&gt; (acc, Word8)
</span><a href="#local-6989586621679075372"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075371"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075371"><span class="hs-identifier hs-var">s0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="#local-6989586621679075370"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075371"><span class="hs-identifier hs-var">s0</span></a></span><span>
</span><span id="line-581"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-582"></span><span>    </span><span id="local-6989586621679075370"><span class="annot"><span class="annottext">go :: acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="#local-6989586621679075370"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679075369"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075369"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075369"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-583"></span><span>    </span><span class="annot"><a href="#local-6989586621679075370"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679075368"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075368"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075367"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075367"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075366"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075366"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075365"><span class="hs-identifier hs-var">s''</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075364"><span class="hs-identifier hs-var">c'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075363"><span class="hs-identifier hs-var">cs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-584"></span><span>        </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075362"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075362"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621679075364"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075364"><span class="hs-identifier hs-var">c'</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
forall acc.
(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="Data.ByteString.html#mapAccumL"><span class="hs-identifier hs-var">S.mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; Word8 -&gt; (acc, Word8)
</span><a href="#local-6989586621679075372"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075368"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075367"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-585"></span><span>              </span><span class="hs-special">(</span><span id="local-6989586621679075365"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075365"><span class="hs-identifier hs-var">s''</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679075363"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075363"><span class="hs-identifier hs-var">cs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="#local-6989586621679075370"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075362"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075366"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-586"></span><span>
</span><span id="line-587"></span><span class="hs-comment">-- | The 'mapAccumR' function behaves like a combination of 'map' and</span><span>
</span><span id="line-588"></span><span class="hs-comment">-- 'foldr'; it applies a function to each element of a ByteString,</span><span>
</span><span id="line-589"></span><span class="hs-comment">-- passing an accumulating parameter from right to left, and returning a</span><span>
</span><span id="line-590"></span><span class="hs-comment">-- final value of this accumulator together with the new ByteString.</span><span>
</span><span id="line-591"></span><span id="local-6989586621679075360"><span class="annot"><a href="Data.ByteString.Lazy.html#mapAccumR"><span class="hs-identifier hs-type">mapAccumR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679075360"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679075360"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075360"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679075360"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-592"></span><span id="mapAccumR"><span class="annot"><span class="annottext">mapAccumR :: forall acc.
(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="Data.ByteString.Lazy.html#mapAccumR"><span class="hs-identifier hs-var hs-var">mapAccumR</span></a></span></span><span> </span><span id="local-6989586621679075359"><span class="annot"><span class="annottext">acc -&gt; Word8 -&gt; (acc, Word8)
</span><a href="#local-6989586621679075359"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075358"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075358"><span class="hs-identifier hs-var">s0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="#local-6989586621679075357"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075358"><span class="hs-identifier hs-var">s0</span></a></span><span>
</span><span id="line-593"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-594"></span><span>    </span><span id="local-6989586621679075357"><span class="annot"><span class="annottext">go :: acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="#local-6989586621679075357"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679075356"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075356"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075356"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-595"></span><span>    </span><span class="annot"><a href="#local-6989586621679075357"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679075355"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075355"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075354"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075354"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075353"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075353"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075352"><span class="hs-identifier hs-var">s''</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075351"><span class="hs-identifier hs-var">c'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075350"><span class="hs-identifier hs-var">cs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-596"></span><span>        </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075352"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075352"><span class="hs-identifier hs-var">s''</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679075351"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075351"><span class="hs-identifier hs-var">c'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
forall acc.
(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="Data.ByteString.html#mapAccumR"><span class="hs-identifier hs-var">S.mapAccumR</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; Word8 -&gt; (acc, Word8)
</span><a href="#local-6989586621679075359"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075348"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075354"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-597"></span><span>              </span><span class="hs-special">(</span><span id="local-6989586621679075348"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075348"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679075350"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075350"><span class="hs-identifier hs-var">cs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="#local-6989586621679075357"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679075355"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075353"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-598"></span><span>
</span><span id="line-599"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-600"></span><span class="hs-comment">-- Building ByteStrings</span><span>
</span><span id="line-601"></span><span>
</span><span id="line-602"></span><span class="hs-comment">-- | 'scanl' is similar to 'foldl', but returns a list of successive</span><span>
</span><span id="line-603"></span><span class="hs-comment">-- reduced values from the left. This function will fuse.</span><span>
</span><span id="line-604"></span><span class="hs-comment">--</span><span>
</span><span id="line-605"></span><span class="hs-comment">-- &gt; scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]</span><span>
</span><span id="line-606"></span><span class="hs-comment">--</span><span>
</span><span id="line-607"></span><span class="hs-comment">-- Note that</span><span>
</span><span id="line-608"></span><span class="hs-comment">--</span><span>
</span><span id="line-609"></span><span class="hs-comment">-- &gt; last (scanl f z xs) == foldl f z xs.</span><span>
</span><span id="line-610"></span><span class="annot"><a href="Data.ByteString.Lazy.html#scanl"><span class="hs-identifier hs-type">scanl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-611"></span><span id="scanl"><span class="annot"><span class="annottext">scanl :: (Word8 -&gt; Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#scanl"><span class="hs-identifier hs-var hs-var">scanl</span></a></span></span><span> </span><span id="local-6989586621679075347"><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><a href="#local-6989586621679075347"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075346"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075346"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8, ByteString) -&gt; ByteString
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">((Word8, ByteString) -&gt; ByteString)
-&gt; (ByteString -&gt; (Word8, ByteString)) -&gt; ByteString -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">((Word8, ByteString) -&gt; Word8 -&gt; (Word8, ByteString))
-&gt; (Word8, ByteString) -&gt; ByteString -&gt; (Word8, ByteString)
forall a. (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8, ByteString) -&gt; Word8 -&gt; (Word8, ByteString)
</span><a href="#local-6989586621679075345"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075346"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075346"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-612"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-613"></span><span>    </span><span id="local-6989586621679075345"><span class="annot"><span class="annottext">k :: (Word8, ByteString) -&gt; Word8 -&gt; (Word8, ByteString)
</span><a href="#local-6989586621679075345"><span class="hs-identifier hs-var hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075344"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075344"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679075343"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075343"><span class="hs-identifier hs-var">acc</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679075342"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075342"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679075341"><span class="annot"><span class="annottext">n :: Word8
</span><a href="#local-6989586621679075341"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8
</span><a href="#local-6989586621679075347"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075344"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075342"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075341"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075343"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#snoc"><span class="hs-operator hs-var">`snoc`</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075341"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-614"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#scanl"><span class="hs-pragma hs-type">scanl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-615"></span><span>
</span><span id="line-616"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-617"></span><span class="hs-comment">-- Unfolds and replicates</span><span>
</span><span id="line-618"></span><span>
</span><span id="line-619"></span><span class="hs-comment">-- | @'iterate' f x@ returns an infinite ByteString of repeated applications</span><span>
</span><span id="line-620"></span><span class="hs-comment">-- of @f@ to @x@:</span><span>
</span><span id="line-621"></span><span class="hs-comment">--</span><span>
</span><span id="line-622"></span><span class="hs-comment">-- &gt; iterate f x == [x, f x, f (f x), ...]</span><span>
</span><span id="line-623"></span><span class="hs-comment">--</span><span>
</span><span id="line-624"></span><span class="annot"><a href="Data.ByteString.Lazy.html#iterate"><span class="hs-identifier hs-type">iterate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-625"></span><span id="iterate"><span class="annot"><span class="annottext">iterate :: (Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#iterate"><span class="hs-identifier hs-var hs-var">iterate</span></a></span></span><span> </span><span id="local-6989586621679075340"><span class="annot"><span class="annottext">Word8 -&gt; Word8
</span><a href="#local-6989586621679075340"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Maybe (Word8, Word8)) -&gt; Word8 -&gt; ByteString
forall a. (a -&gt; Maybe (Word8, a)) -&gt; a -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#unfoldr"><span class="hs-identifier hs-var">unfoldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679075339"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075339"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8
</span><a href="#local-6989586621679075340"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075339"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679075338"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075338"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Word8, Word8) -&gt; Maybe (Word8, Word8)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075338"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075338"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-626"></span><span>
</span><span id="line-627"></span><span class="hs-comment">-- | @'repeat' x@ is an infinite ByteString, with @x@ the value of every</span><span>
</span><span id="line-628"></span><span class="hs-comment">-- element.</span><span>
</span><span id="line-629"></span><span class="hs-comment">--</span><span>
</span><span id="line-630"></span><span class="annot"><a href="Data.ByteString.Lazy.html#repeat"><span class="hs-identifier hs-type">repeat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-631"></span><span id="repeat"><span class="annot"><span class="annottext">repeat :: Word8 -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#repeat"><span class="hs-identifier hs-var hs-var">repeat</span></a></span></span><span> </span><span id="local-6989586621679075337"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075337"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075336"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075336"><span class="annot"><span class="annottext">cs :: ByteString
</span><a href="#local-6989586621679075336"><span class="hs-identifier hs-var hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#replicate"><span class="hs-identifier hs-var">S.replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.ByteString.Lazy.Internal.html#smallChunkSize"><span class="hs-identifier hs-var">smallChunkSize</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075337"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075336"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-632"></span><span>
</span><span id="line-633"></span><span class="hs-comment">-- | /O(n)/ @'replicate' n x@ is a ByteString of length @n@ with @x@</span><span>
</span><span id="line-634"></span><span class="hs-comment">-- the value of every element.</span><span>
</span><span id="line-635"></span><span class="hs-comment">--</span><span>
</span><span id="line-636"></span><span class="annot"><a href="Data.ByteString.Lazy.html#replicate"><span class="hs-identifier hs-type">replicate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-637"></span><span id="replicate"><span class="annot"><span class="annottext">replicate :: Int64 -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#replicate"><span class="hs-identifier hs-var hs-var">replicate</span></a></span></span><span> </span><span id="local-6989586621679075333"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075333"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679075332"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075332"><span class="hs-identifier hs-var">w</span></a></span></span><span>
</span><span id="line-638"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075333"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-639"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075333"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.ByteString.Lazy.Internal.html#smallChunkSize"><span class="hs-identifier hs-var">smallChunkSize</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#replicate"><span class="hs-identifier hs-var">S.replicate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075333"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075332"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-640"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075330"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075329"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-comment">-- preserve invariant</span><span>
</span><span id="line-641"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTake"><span class="hs-identifier hs-var">S.unsafeTake</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075330"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075327"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075329"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-642"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-643"></span><span>    </span><span id="local-6989586621679075327"><span class="annot"><span class="annottext">c :: ByteString
</span><a href="#local-6989586621679075327"><span class="hs-identifier hs-var hs-var">c</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#replicate"><span class="hs-identifier hs-var">S.replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.ByteString.Lazy.Internal.html#smallChunkSize"><span class="hs-identifier hs-var">smallChunkSize</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075332"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-644"></span><span>    </span><span id="local-6989586621679075329"><span class="annot"><span class="annottext">cs :: ByteString
</span><a href="#local-6989586621679075329"><span class="hs-identifier hs-var hs-var">cs</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; ByteString
forall {t}. (Eq t, Num t) =&gt; t -&gt; ByteString
</span><a href="#local-6989586621679075324"><span class="hs-identifier hs-var">nChunks</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075323"><span class="hs-identifier hs-var">q</span></a></span><span>
</span><span id="line-645"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679075323"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075323"><span class="hs-identifier hs-var">q</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679075330"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075330"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; (Int64, Int64)
forall a. Integral a =&gt; a -&gt; a -&gt; (a, a)
</span><a href="../../base/src/GHC.Real.html#quotRem"><span class="hs-identifier hs-var">quotRem</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075333"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.ByteString.Lazy.Internal.html#smallChunkSize"><span class="hs-identifier hs-var">smallChunkSize</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-646"></span><span>    </span><span id="local-6989586621679075324"><span class="annot"><span class="annottext">nChunks :: t -&gt; ByteString
</span><a href="#local-6989586621679075324"><span class="hs-identifier hs-var hs-var">nChunks</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-647"></span><span>    </span><span class="annot"><a href="#local-6989586621679075324"><span class="hs-identifier hs-var">nChunks</span></a></span><span> </span><span id="local-6989586621679075312"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075312"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075327"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t -&gt; ByteString
</span><a href="#local-6989586621679075324"><span class="hs-identifier hs-var">nChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075312"><span class="hs-identifier hs-var">m</span></a></span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">t
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-648"></span><span>
</span><span id="line-649"></span><span class="hs-comment">-- | 'cycle' ties a finite ByteString into a circular one, or equivalently,</span><span>
</span><span id="line-650"></span><span class="hs-comment">-- the infinite repetition of the original ByteString.</span><span>
</span><span id="line-651"></span><span class="hs-comment">--</span><span>
</span><span id="line-652"></span><span class="annot"><a href="Data.ByteString.Lazy.html#cycle"><span class="hs-identifier hs-type">cycle</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-653"></span><span id="cycle"><span class="annot"><span class="annottext">cycle :: ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#cycle"><span class="hs-identifier hs-var hs-var">cycle</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; ByteString
forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;cycle&quot;</span></span><span>
</span><span id="line-654"></span><span class="annot"><a href="Data.ByteString.Lazy.html#cycle"><span class="hs-identifier hs-var">cycle</span></a></span><span> </span><span id="local-6989586621679075311"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075311"><span class="hs-identifier hs-var">cs</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075310"><span class="hs-identifier hs-var">cs'</span></a></span><span> </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075310"><span class="annot"><span class="annottext">cs' :: ByteString
</span><a href="#local-6989586621679075310"><span class="hs-identifier hs-var hs-var">cs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; ByteString -&gt; ByteString -&gt; ByteString
forall a. (ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier hs-var">foldrChunks</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075310"><span class="hs-identifier hs-var">cs'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075311"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-655"></span><span>
</span><span id="line-656"></span><span class="hs-comment">-- | /O(n)/ The 'unfoldr' function is analogous to the List \'unfoldr\'.</span><span>
</span><span id="line-657"></span><span class="hs-comment">-- 'unfoldr' builds a ByteString from a seed value.  The function takes</span><span>
</span><span id="line-658"></span><span class="hs-comment">-- the element and returns 'Nothing' if it is done producing the</span><span>
</span><span id="line-659"></span><span class="hs-comment">-- ByteString or returns 'Just' @(a,b)@, in which case, @a@ is a</span><span>
</span><span id="line-660"></span><span class="hs-comment">-- prepending to the ByteString and @b@ is used as the next element in a</span><span>
</span><span id="line-661"></span><span class="hs-comment">-- recursive call.</span><span>
</span><span id="line-662"></span><span id="local-6989586621679075901"><span class="annot"><a href="Data.ByteString.Lazy.html#unfoldr"><span class="hs-identifier hs-type">unfoldr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679075901"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679075901"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075901"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span></span><span>
</span><span id="line-663"></span><span id="unfoldr"><span class="annot"><span class="annottext">unfoldr :: forall a. (a -&gt; Maybe (Word8, a)) -&gt; a -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#unfoldr"><span class="hs-identifier hs-var hs-var">unfoldr</span></a></span></span><span> </span><span id="local-6989586621679075309"><span class="annot"><span class="annottext">a -&gt; Maybe (Word8, a)
</span><a href="#local-6989586621679075309"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075308"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075308"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; ByteString
</span><a href="#local-6989586621679075307"><span class="hs-identifier hs-var">unfoldChunk</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">32</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075308"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-664"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075307"><span class="annot"><span class="annottext">unfoldChunk :: Int -&gt; a -&gt; ByteString
</span><a href="#local-6989586621679075307"><span class="hs-identifier hs-var hs-var">unfoldChunk</span></a></span></span><span> </span><span id="local-6989586621679075304"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075304"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679075303"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075303"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-665"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; (a -&gt; Maybe (Word8, a)) -&gt; a -&gt; (ByteString, Maybe a)
forall a.
Int -&gt; (a -&gt; Maybe (Word8, a)) -&gt; a -&gt; (ByteString, Maybe a)
</span><a href="Data.ByteString.html#unfoldrN"><span class="hs-identifier hs-var">S.unfoldrN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075304"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe (Word8, a)
</span><a href="#local-6989586621679075309"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075303"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-666"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621679075301"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075301"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-667"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075301"><span class="hs-identifier hs-var">c</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-668"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075301"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-669"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621679075300"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075300"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679075299"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075299"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075300"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; ByteString
</span><a href="#local-6989586621679075307"><span class="hs-identifier hs-var">unfoldChunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075304"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075299"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-670"></span><span>
</span><span id="line-671"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-672"></span><span class="hs-comment">-- Substrings</span><span>
</span><span id="line-673"></span><span>
</span><span id="line-674"></span><span class="hs-comment">-- | /O(n\/c)/ 'take' @n@, applied to a ByteString @xs@, returns the prefix</span><span>
</span><span id="line-675"></span><span class="hs-comment">-- of @xs@ of length @n@, or @xs@ itself if @n &gt; 'length' xs@.</span><span>
</span><span id="line-676"></span><span class="annot"><a href="Data.ByteString.Lazy.html#take"><span class="hs-identifier hs-type">take</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-677"></span><span id="take"><span class="annot"><span class="annottext">take :: Int64 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#take"><span class="hs-identifier hs-var hs-var">take</span></a></span></span><span> </span><span id="local-6989586621679075298"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075298"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075298"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-678"></span><span class="annot"><a href="Data.ByteString.Lazy.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span id="local-6989586621679075297"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075297"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679075296"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075296"><span class="hs-identifier hs-var">cs0</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; ByteString -&gt; ByteString
forall {t}. Integral t =&gt; t -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075295"><span class="hs-identifier hs-var">take'</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075297"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075296"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-679"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075295"><span class="annot"><span class="annottext">take' :: t -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075295"><span class="hs-identifier hs-var hs-var">take'</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-680"></span><span>        </span><span class="annot"><a href="#local-6989586621679075295"><span class="hs-identifier hs-var">take'</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-681"></span><span>        </span><span class="annot"><a href="#local-6989586621679075295"><span class="hs-identifier hs-var">take'</span></a></span><span> </span><span id="local-6989586621679075275"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075275"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075274"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075274"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075273"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075273"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-682"></span><span>          </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075275"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; t
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075274"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-683"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#take"><span class="hs-identifier hs-var">S.take</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075275"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075274"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-684"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075274"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075295"><span class="hs-identifier hs-var">take'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075275"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; t
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075274"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075273"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-685"></span><span>
</span><span id="line-686"></span><span class="hs-comment">-- | /O(n\/c)/ 'drop' @n xs@ returns the suffix of @xs@ after the first @n@</span><span>
</span><span id="line-687"></span><span class="hs-comment">-- elements, or @[]@ if @n &gt; 'length' xs@.</span><span>
</span><span id="line-688"></span><span class="annot"><a href="Data.ByteString.Lazy.html#drop"><span class="hs-identifier hs-type">drop</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-689"></span><span id="drop"><span class="annot"><span class="annottext">drop :: Int64 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#drop"><span class="hs-identifier hs-var hs-var">drop</span></a></span></span><span> </span><span id="local-6989586621679075271"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075271"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679075270"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075270"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075271"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075270"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-690"></span><span class="annot"><a href="Data.ByteString.Lazy.html#drop"><span class="hs-identifier hs-var">drop</span></a></span><span> </span><span id="local-6989586621679075269"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075269"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679075268"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075268"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; ByteString -&gt; ByteString
forall {t}. Integral t =&gt; t -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075267"><span class="hs-identifier hs-var">drop'</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075269"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075268"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-691"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075267"><span class="annot"><span class="annottext">drop' :: t -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075267"><span class="hs-identifier hs-var hs-var">drop'</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">0</span></span><span> </span><span id="local-6989586621679075251"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075251"><span class="hs-identifier hs-var">cs</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075251"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-692"></span><span>        </span><span class="annot"><a href="#local-6989586621679075267"><span class="hs-identifier hs-var">drop'</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-693"></span><span>        </span><span class="annot"><a href="#local-6989586621679075267"><span class="hs-identifier hs-var">drop'</span></a></span><span> </span><span id="local-6989586621679075250"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075250"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075249"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075249"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075248"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075248"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-694"></span><span>          </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075250"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; t
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075249"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-695"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#drop"><span class="hs-identifier hs-var">S.drop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075250"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075249"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075248"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-696"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">t -&gt; ByteString -&gt; ByteString
</span><a href="#local-6989586621679075267"><span class="hs-identifier hs-var">drop'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679075250"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; t
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075249"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075248"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-697"></span><span>
</span><span id="line-698"></span><span class="hs-comment">-- | /O(n\/c)/ 'splitAt' @n xs@ is equivalent to @('take' n xs, 'drop' n xs)@.</span><span>
</span><span id="line-699"></span><span class="annot"><a href="Data.ByteString.Lazy.html#splitAt"><span class="hs-identifier hs-type">splitAt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-700"></span><span id="splitAt"><span class="annot"><span class="annottext">splitAt :: Int64 -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Lazy.html#splitAt"><span class="hs-identifier hs-var hs-var">splitAt</span></a></span></span><span> </span><span id="local-6989586621679075246"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075246"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679075245"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075245"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075246"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075245"><span class="hs-identifier hs-var">cs0</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-701"></span><span class="annot"><a href="Data.ByteString.Lazy.html#splitAt"><span class="hs-identifier hs-var">splitAt</span></a></span><span> </span><span id="local-6989586621679075244"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075244"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679075243"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075243"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; ByteString -&gt; (ByteString, ByteString)
forall {a}.
Integral a =&gt;
a -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="#local-6989586621679075242"><span class="hs-identifier hs-var">splitAt'</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075244"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075243"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-702"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075242"><span class="annot"><span class="annottext">splitAt' :: a -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="#local-6989586621679075242"><span class="hs-identifier hs-var hs-var">splitAt'</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span id="local-6989586621679075227"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075227"><span class="hs-identifier hs-var">cs</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075227"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-703"></span><span>        </span><span class="annot"><a href="#local-6989586621679075242"><span class="hs-identifier hs-var">splitAt'</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-704"></span><span>        </span><span class="annot"><a href="#local-6989586621679075242"><span class="hs-identifier hs-var">splitAt'</span></a></span><span> </span><span id="local-6989586621679075226"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075226"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075225"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075225"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075224"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075224"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-705"></span><span>          </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075226"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075225"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-706"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#take"><span class="hs-identifier hs-var">S.take</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075226"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075225"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-707"></span><span>                 </span><span class="hs-special">,</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#drop"><span class="hs-identifier hs-var">S.drop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075226"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075225"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075224"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-708"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075220"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075220"><span class="hs-identifier hs-var">cs'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679075219"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075219"><span class="hs-identifier hs-var">cs''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="#local-6989586621679075242"><span class="hs-identifier hs-var">splitAt'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075226"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075225"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075224"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-709"></span><span>                   </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075225"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075220"><span class="hs-identifier hs-var">cs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075219"><span class="hs-identifier hs-var">cs''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-710"></span><span>
</span><span id="line-711"></span><span>
</span><span id="line-712"></span><span class="hs-comment">-- | 'takeWhile', applied to a predicate @p@ and a ByteString @xs@,</span><span>
</span><span id="line-713"></span><span class="hs-comment">-- returns the longest prefix (possibly empty) of @xs@ of elements that</span><span>
</span><span id="line-714"></span><span class="hs-comment">-- satisfy @p@.</span><span>
</span><span id="line-715"></span><span class="annot"><a href="Data.ByteString.Lazy.html#takeWhile"><span class="hs-identifier hs-type">takeWhile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-716"></span><span id="takeWhile"><span class="annot"><span class="annottext">takeWhile :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#takeWhile"><span class="hs-identifier hs-var hs-var">takeWhile</span></a></span></span><span> </span><span id="local-6989586621679075218"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075218"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075217"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075217"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679075216"><span class="hs-identifier hs-var">takeWhile'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075217"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-717"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075216"><span class="annot"><span class="annottext">takeWhile' :: ByteString -&gt; ByteString
</span><a href="#local-6989586621679075216"><span class="hs-identifier hs-var hs-var">takeWhile'</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-718"></span><span>        </span><span class="annot"><a href="#local-6989586621679075216"><span class="hs-identifier hs-var">takeWhile'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075212"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075212"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075211"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075211"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-719"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Int
</span><a href="Data.ByteString.Lazy.html#findIndexOrEnd"><span class="hs-identifier hs-var">findIndexOrEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Word8 -&gt; Bool) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075218"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075212"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-720"></span><span>            </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-721"></span><span>            </span><span id="local-6989586621679075208"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075208"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075208"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075212"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#take"><span class="hs-identifier hs-var">S.take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075208"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075212"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-722"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075212"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679075216"><span class="hs-identifier hs-var">takeWhile'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075211"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-723"></span><span>
</span><span id="line-724"></span><span class="hs-comment">-- | 'dropWhile' @p xs@ returns the suffix remaining after 'takeWhile' @p xs@.</span><span>
</span><span id="line-725"></span><span class="annot"><a href="Data.ByteString.Lazy.html#dropWhile"><span class="hs-identifier hs-type">dropWhile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-726"></span><span id="dropWhile"><span class="annot"><span class="annottext">dropWhile :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#dropWhile"><span class="hs-identifier hs-var hs-var">dropWhile</span></a></span></span><span> </span><span id="local-6989586621679075207"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075207"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075206"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075206"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679075205"><span class="hs-identifier hs-var">dropWhile'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075206"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-727"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075205"><span class="annot"><span class="annottext">dropWhile' :: ByteString -&gt; ByteString
</span><a href="#local-6989586621679075205"><span class="hs-identifier hs-var hs-var">dropWhile'</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-728"></span><span>        </span><span class="annot"><a href="#local-6989586621679075205"><span class="hs-identifier hs-var">dropWhile'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075203"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075203"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075202"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075202"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-729"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Int
</span><a href="Data.ByteString.Lazy.html#findIndexOrEnd"><span class="hs-identifier hs-var">findIndexOrEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Word8 -&gt; Bool) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075207"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075203"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-730"></span><span>            </span><span id="local-6989586621679075201"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075201"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075201"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075203"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#drop"><span class="hs-identifier hs-var">S.drop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075201"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075203"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075202"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-731"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679075205"><span class="hs-identifier hs-var">dropWhile'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075202"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-732"></span><span>
</span><span id="line-733"></span><span class="hs-comment">-- | 'break' @p@ is equivalent to @'span' ('not' . p)@.</span><span>
</span><span id="line-734"></span><span class="annot"><a href="Data.ByteString.Lazy.html#break"><span class="hs-identifier hs-type">break</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-735"></span><span id="break"><span class="annot"><span class="annottext">break :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Lazy.html#break"><span class="hs-identifier hs-var hs-var">break</span></a></span></span><span> </span><span id="local-6989586621679075200"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075200"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075199"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075199"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; (ByteString, ByteString)
</span><a href="#local-6989586621679075198"><span class="hs-identifier hs-var">break'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075199"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-736"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075198"><span class="annot"><span class="annottext">break' :: ByteString -&gt; (ByteString, ByteString)
</span><a href="#local-6989586621679075198"><span class="hs-identifier hs-var hs-var">break'</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-737"></span><span>        </span><span class="annot"><a href="#local-6989586621679075198"><span class="hs-identifier hs-var">break'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075194"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075194"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075193"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075193"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-738"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Int
</span><a href="Data.ByteString.Lazy.html#findIndexOrEnd"><span class="hs-identifier hs-var">findIndexOrEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075200"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075194"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-739"></span><span>            </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075194"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075193"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-740"></span><span>            </span><span id="local-6989586621679075192"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075192"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075192"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075194"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#take"><span class="hs-identifier hs-var">S.take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075192"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075194"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-741"></span><span>                                  </span><span class="hs-special">,</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#drop"><span class="hs-identifier hs-var">S.drop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075192"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075194"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075193"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-742"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075191"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075191"><span class="hs-identifier hs-var">cs'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679075190"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075190"><span class="hs-identifier hs-var">cs''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; (ByteString, ByteString)
</span><a href="#local-6989586621679075198"><span class="hs-identifier hs-var">break'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075193"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-743"></span><span>                                   </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075194"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075191"><span class="hs-identifier hs-var">cs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075190"><span class="hs-identifier hs-var">cs''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-744"></span><span>
</span><span id="line-745"></span><span class="hs-comment">--</span><span>
</span><span id="line-746"></span><span class="hs-comment">-- TODO</span><span>
</span><span id="line-747"></span><span class="hs-comment">--</span><span>
</span><span id="line-748"></span><span class="hs-comment">-- Add rules</span><span>
</span><span id="line-749"></span><span class="hs-comment">--</span><span>
</span><span id="line-750"></span><span>
</span><span id="line-751"></span><span class="hs-comment">{-
-- | 'breakByte' breaks its ByteString argument at the first occurence
-- of the specified byte. It is more efficient than 'break' as it is
-- implemented with @memchr(3)@. I.e.
--
-- &gt; break (==99) &quot;abcd&quot; == breakByte 99 &quot;abcd&quot; -- fromEnum 'c' == 99
--
breakByte :: Word8 -&gt; ByteString -&gt; (ByteString, ByteString)
breakByte c (LPS ps) = case (breakByte' ps) of (a,b) -&gt; (LPS a, LPS b)
  where breakByte' []     = ([], [])
        breakByte' (x:xs) =
          case P.elemIndex c x of
            Just 0  -&gt; ([], x : xs)
            Just n  -&gt; (P.take n x : [], P.drop n x : xs)
            Nothing -&gt; let (xs', xs'') = breakByte' xs
                        in (x : xs', xs'')

-- | 'spanByte' breaks its ByteString argument at the first
-- occurence of a byte other than its argument. It is more efficient
-- than 'span (==)'
--
-- &gt; span  (==99) &quot;abcd&quot; == spanByte 99 &quot;abcd&quot; -- fromEnum 'c' == 99
--
spanByte :: Word8 -&gt; ByteString -&gt; (ByteString, ByteString)
spanByte c (LPS ps) = case (spanByte' ps) of (a,b) -&gt; (LPS a, LPS b)
  where spanByte' []     = ([], [])
        spanByte' (x:xs) =
          case P.spanByte c x of
            (x', x'') | P.null x'  -&gt; ([], x : xs)
                      | P.null x'' -&gt; let (xs', xs'') = spanByte' xs
                                       in (x : xs', xs'')
                      | otherwise  -&gt; (x' : [], x'' : xs)
-}</span><span>
</span><span id="line-784"></span><span>
</span><span id="line-785"></span><span class="hs-comment">-- | 'span' @p xs@ breaks the ByteString into two segments. It is</span><span>
</span><span id="line-786"></span><span class="hs-comment">-- equivalent to @('takeWhile' p xs, 'dropWhile' p xs)@</span><span>
</span><span id="line-787"></span><span class="annot"><a href="Data.ByteString.Lazy.html#span"><span class="hs-identifier hs-type">span</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-788"></span><span id="span"><span class="annot"><span class="annottext">span :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Lazy.html#span"><span class="hs-identifier hs-var hs-var">span</span></a></span></span><span> </span><span id="local-6989586621679075189"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075189"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Lazy.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Word8 -&gt; Bool) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075189"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-789"></span><span>
</span><span id="line-790"></span><span class="hs-comment">-- | /O(n)/ Splits a 'ByteString' into components delimited by</span><span>
</span><span id="line-791"></span><span class="hs-comment">-- separators, where the predicate returns True for a separator element.</span><span>
</span><span id="line-792"></span><span class="hs-comment">-- The resulting components do not contain the separators.  Two adjacent</span><span>
</span><span id="line-793"></span><span class="hs-comment">-- separators result in an empty component in the output.  eg.</span><span>
</span><span id="line-794"></span><span class="hs-comment">--</span><span>
</span><span id="line-795"></span><span class="hs-comment">-- &gt; splitWith (==97) &quot;aabbaca&quot; == [&quot;&quot;,&quot;&quot;,&quot;bb&quot;,&quot;c&quot;,&quot;&quot;] -- fromEnum 'a' == 97</span><span>
</span><span id="line-796"></span><span class="hs-comment">-- &gt; splitWith (==97) []        == []</span><span>
</span><span id="line-797"></span><span class="hs-comment">--</span><span>
</span><span id="line-798"></span><span class="annot"><a href="Data.ByteString.Lazy.html#splitWith"><span class="hs-identifier hs-type">splitWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-799"></span><span id="splitWith"><span class="annot"><span class="annottext">splitWith :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#splitWith"><span class="hs-identifier hs-var hs-var">splitWith</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-800"></span><span class="annot"><a href="Data.ByteString.Lazy.html#splitWith"><span class="hs-identifier hs-var">splitWith</span></a></span><span> </span><span id="local-6989586621679075188"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075188"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075187"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075187"><span class="hs-identifier hs-var">c0</span></a></span></span><span> </span><span id="local-6989586621679075186"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075186"><span class="hs-identifier hs-var">cs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; [ByteString] -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075185"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.html#splitWith"><span class="hs-identifier hs-var">S.splitWith</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075188"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075187"><span class="hs-identifier hs-var">c0</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075186"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-801"></span><span>
</span><span id="line-802"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="#local-6989586621679075185"><span class="hs-identifier hs-type">comb</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-803"></span><span>        </span><span id="local-6989586621679075185"><span class="annot"><span class="annottext">comb :: [ByteString] -&gt; [ByteString] -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075185"><span class="hs-identifier hs-var hs-var">comb</span></a></span></span><span> </span><span id="local-6989586621679075183"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075183"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075182"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075182"><span class="hs-identifier hs-var">s</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revChunks"><span class="hs-identifier hs-var">revChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075182"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075183"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-804"></span><span>        </span><span class="annot"><a href="#local-6989586621679075185"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span id="local-6989586621679075180"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075180"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075179"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075179"><span class="hs-identifier hs-var">s</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075178"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075178"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075177"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075177"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; [ByteString] -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075185"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075179"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075180"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.html#splitWith"><span class="hs-identifier hs-var">S.splitWith</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075188"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075178"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075177"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-805"></span><span>        </span><span class="annot"><a href="#local-6989586621679075185"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span id="local-6989586621679075176"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075176"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075175"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075175"><span class="hs-identifier hs-var">s</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679075174"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075174"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679075173"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075173"><span class="hs-identifier hs-var">cs</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revChunks"><span class="hs-identifier hs-var">revChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075175"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075176"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; [ByteString] -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075185"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075174"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075173"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-806"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#splitWith"><span class="hs-pragma hs-type">splitWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-807"></span><span>
</span><span id="line-808"></span><span class="hs-comment">-- | /O(n)/ Break a 'ByteString' into pieces separated by the byte</span><span>
</span><span id="line-809"></span><span class="hs-comment">-- argument, consuming the delimiter. I.e.</span><span>
</span><span id="line-810"></span><span class="hs-comment">--</span><span>
</span><span id="line-811"></span><span class="hs-comment">-- &gt; split 10  &quot;a\nb\nd\ne&quot; == [&quot;a&quot;,&quot;b&quot;,&quot;d&quot;,&quot;e&quot;]   -- fromEnum '\n' == 10</span><span>
</span><span id="line-812"></span><span class="hs-comment">-- &gt; split 97  &quot;aXaXaXa&quot;    == [&quot;&quot;,&quot;X&quot;,&quot;X&quot;,&quot;X&quot;,&quot;&quot;] -- fromEnum 'a' == 97</span><span>
</span><span id="line-813"></span><span class="hs-comment">-- &gt; split 120 &quot;x&quot;          == [&quot;&quot;,&quot;&quot;]             -- fromEnum 'x' == 120</span><span>
</span><span id="line-814"></span><span class="hs-comment">--</span><span>
</span><span id="line-815"></span><span class="hs-comment">-- and</span><span>
</span><span id="line-816"></span><span class="hs-comment">--</span><span>
</span><span id="line-817"></span><span class="hs-comment">-- &gt; intercalate [c] . split c == id</span><span>
</span><span id="line-818"></span><span class="hs-comment">-- &gt; split == splitWith . (==)</span><span>
</span><span id="line-819"></span><span class="hs-comment">--</span><span>
</span><span id="line-820"></span><span class="hs-comment">-- As for all splitting functions in this library, this function does</span><span>
</span><span id="line-821"></span><span class="hs-comment">-- not copy the substrings, it just constructs new 'ByteString's that</span><span>
</span><span id="line-822"></span><span class="hs-comment">-- are slices of the original.</span><span>
</span><span id="line-823"></span><span class="hs-comment">--</span><span>
</span><span id="line-824"></span><span class="annot"><a href="Data.ByteString.Lazy.html#split"><span class="hs-identifier hs-type">split</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-825"></span><span id="split"><span class="annot"><span class="annottext">split :: Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#split"><span class="hs-identifier hs-var hs-var">split</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-826"></span><span class="annot"><a href="Data.ByteString.Lazy.html#split"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span id="local-6989586621679075172"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075172"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075171"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075171"><span class="hs-identifier hs-var">c0</span></a></span></span><span> </span><span id="local-6989586621679075170"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075170"><span class="hs-identifier hs-var">cs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; [ByteString] -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075169"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.html#split"><span class="hs-identifier hs-var">S.split</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075172"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075171"><span class="hs-identifier hs-var">c0</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075170"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-827"></span><span>
</span><span id="line-828"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="#local-6989586621679075169"><span class="hs-identifier hs-type">comb</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-829"></span><span>        </span><span id="local-6989586621679075169"><span class="annot"><span class="annottext">comb :: [ByteString] -&gt; [ByteString] -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075169"><span class="hs-identifier hs-var hs-var">comb</span></a></span></span><span> </span><span id="local-6989586621679075167"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075167"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075166"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075166"><span class="hs-identifier hs-var">s</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revChunks"><span class="hs-identifier hs-var">revChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075166"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075167"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-830"></span><span>        </span><span class="annot"><a href="#local-6989586621679075169"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span id="local-6989586621679075165"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075165"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075164"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075164"><span class="hs-identifier hs-var">s</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075163"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075163"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075162"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075162"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; [ByteString] -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075169"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075164"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075165"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.html#split"><span class="hs-identifier hs-var">S.split</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075172"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075163"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075162"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-831"></span><span>        </span><span class="annot"><a href="#local-6989586621679075169"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span id="local-6989586621679075161"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075161"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679075160"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075160"><span class="hs-identifier hs-var">s</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679075159"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075159"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679075158"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075158"><span class="hs-identifier hs-var">cs</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revChunks"><span class="hs-identifier hs-var">revChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075160"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075161"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; [ByteString] -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075169"><span class="hs-identifier hs-var">comb</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075159"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075158"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-832"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#split"><span class="hs-pragma hs-type">split</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-833"></span><span>
</span><span id="line-834"></span><span class="hs-comment">-- | The 'group' function takes a ByteString and returns a list of</span><span>
</span><span id="line-835"></span><span class="hs-comment">-- ByteStrings such that the concatenation of the result is equal to the</span><span>
</span><span id="line-836"></span><span class="hs-comment">-- argument.  Moreover, each sublist in the result contains only equal</span><span>
</span><span id="line-837"></span><span class="hs-comment">-- elements.  For example,</span><span>
</span><span id="line-838"></span><span class="hs-comment">--</span><span>
</span><span id="line-839"></span><span class="hs-comment">-- &gt; group &quot;Mississippi&quot; = [&quot;M&quot;,&quot;i&quot;,&quot;ss&quot;,&quot;i&quot;,&quot;ss&quot;,&quot;i&quot;,&quot;pp&quot;,&quot;i&quot;]</span><span>
</span><span id="line-840"></span><span class="hs-comment">--</span><span>
</span><span id="line-841"></span><span class="hs-comment">-- It is a special case of 'groupBy', which allows the programmer to</span><span>
</span><span id="line-842"></span><span class="hs-comment">-- supply their own equality test.</span><span>
</span><span id="line-843"></span><span class="annot"><a href="Data.ByteString.Lazy.html#group"><span class="hs-identifier hs-type">group</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-844"></span><span id="group"><span class="annot"><span class="annottext">group :: ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#group"><span class="hs-identifier hs-var hs-var">group</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075157"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-845"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-846"></span><span>    </span><span id="local-6989586621679075157"><span class="annot"><span class="annottext">go :: ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075157"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-847"></span><span>    </span><span class="annot"><a href="#local-6989586621679075157"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075150"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075150"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075149"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075149"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-848"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075150"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075148"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075150"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075150"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075149"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-849"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075148"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTake"><span class="hs-identifier hs-var">S.unsafeTake</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075150"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075150"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075150"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075149"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-850"></span><span>
</span><span id="line-851"></span><span>    </span><span id="local-6989586621679075148"><span class="annot"><span class="annottext">to :: [ByteString] -&gt; Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075148"><span class="hs-identifier hs-var hs-var">to</span></a></span></span><span> </span><span id="local-6989586621679075147"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075147"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revNonEmptyChunks"><span class="hs-identifier hs-var">revNonEmptyChunks</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075147"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-852"></span><span>    </span><span class="annot"><a href="#local-6989586621679075148"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span id="local-6989586621679075145"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075145"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679075144"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075144"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075143"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075143"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075142"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075142"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-853"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Int
</span><a href="Data.ByteString.Lazy.html#findIndexOrEnd"><span class="hs-identifier hs-var">findIndexOrEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075144"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075143"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-854"></span><span>        </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revNonEmptyChunks"><span class="hs-identifier hs-var">revNonEmptyChunks</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075145"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-855"></span><span>                              </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075157"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075143"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075142"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-856"></span><span>        </span><span id="local-6989586621679075140"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075140"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075140"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075143"><span class="hs-identifier hs-var">c</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075148"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTake"><span class="hs-identifier hs-var">S.unsafeTake</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075140"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075143"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075145"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075144"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075142"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-857"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revNonEmptyChunks"><span class="hs-identifier hs-var">revNonEmptyChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTake"><span class="hs-identifier hs-var">S.unsafeTake</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075140"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075143"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075145"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-858"></span><span>                              </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075157"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeDrop"><span class="hs-identifier hs-var">S.unsafeDrop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075140"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075143"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075142"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-859"></span><span>
</span><span id="line-860"></span><span class="hs-comment">-- | The 'groupBy' function is the non-overloaded version of 'group'.</span><span>
</span><span id="line-861"></span><span class="hs-comment">--</span><span>
</span><span id="line-862"></span><span class="annot"><a href="Data.ByteString.Lazy.html#groupBy"><span class="hs-identifier hs-type">groupBy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-863"></span><span id="groupBy"><span class="annot"><span class="annottext">groupBy :: (Word8 -&gt; Word8 -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#groupBy"><span class="hs-identifier hs-var hs-var">groupBy</span></a></span></span><span> </span><span id="local-6989586621679075138"><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
</span><a href="#local-6989586621679075138"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075137"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-864"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-865"></span><span>    </span><span id="local-6989586621679075137"><span class="annot"><span class="annottext">go :: ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075137"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-866"></span><span>    </span><span class="annot"><a href="#local-6989586621679075137"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075131"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075131"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075130"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075130"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-867"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075131"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075129"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075131"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075131"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075130"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-868"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075129"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTake"><span class="hs-identifier hs-var">S.unsafeTake</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075131"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075131"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075131"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075130"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-869"></span><span>
</span><span id="line-870"></span><span>    </span><span id="local-6989586621679075129"><span class="annot"><span class="annottext">to :: [ByteString] -&gt; Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075129"><span class="hs-identifier hs-var hs-var">to</span></a></span></span><span> </span><span id="local-6989586621679075128"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075128"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revNonEmptyChunks"><span class="hs-identifier hs-var">revNonEmptyChunks</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075128"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-871"></span><span>    </span><span class="annot"><a href="#local-6989586621679075129"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span id="local-6989586621679075127"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075127"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679075126"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075126"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075125"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075125"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075124"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075124"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-872"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Int
</span><a href="Data.ByteString.Lazy.html#findIndexOrEnd"><span class="hs-identifier hs-var">findIndexOrEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Word8 -&gt; Bool) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
</span><a href="#local-6989586621679075138"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075126"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075125"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-873"></span><span>        </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revNonEmptyChunks"><span class="hs-identifier hs-var">revNonEmptyChunks</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075127"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-874"></span><span>                              </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075137"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075125"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075124"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-875"></span><span>        </span><span id="local-6989586621679075123"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075123"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075123"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075125"><span class="hs-identifier hs-var">c</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075129"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTake"><span class="hs-identifier hs-var">S.unsafeTake</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075123"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075125"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075127"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075126"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075124"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-876"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revNonEmptyChunks"><span class="hs-identifier hs-var">revNonEmptyChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTake"><span class="hs-identifier hs-var">S.unsafeTake</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075123"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075125"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679075127"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-877"></span><span>                              </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679075137"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeDrop"><span class="hs-identifier hs-var">S.unsafeDrop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075123"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075125"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075124"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-878"></span><span>
</span><span id="line-879"></span><span class="hs-comment">-- | /O(n)/ The 'intercalate' function takes a 'ByteString' and a list of</span><span>
</span><span id="line-880"></span><span class="hs-comment">-- 'ByteString's and concatenates the list after interspersing the first</span><span>
</span><span id="line-881"></span><span class="hs-comment">-- argument between each element of the list.</span><span>
</span><span id="line-882"></span><span class="annot"><a href="Data.ByteString.Lazy.html#intercalate"><span class="hs-identifier hs-type">intercalate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-883"></span><span id="intercalate"><span class="annot"><span class="annottext">intercalate :: ByteString -&gt; [ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#intercalate"><span class="hs-identifier hs-var hs-var">intercalate</span></a></span></span><span> </span><span id="local-6989586621679075122"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075122"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">([ByteString] -&gt; ByteString)
-&gt; ([ByteString] -&gt; [ByteString]) -&gt; [ByteString] -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#intersperse"><span class="hs-identifier hs-var">L.intersperse</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075122"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-884"></span><span>
</span><span id="line-885"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-886"></span><span class="hs-comment">-- Indexing ByteStrings</span><span>
</span><span id="line-887"></span><span>
</span><span id="line-888"></span><span class="hs-comment">-- | /O(c)/ 'ByteString' index (subscript) operator, starting from 0.</span><span>
</span><span id="line-889"></span><span class="annot"><a href="Data.ByteString.Lazy.html#index"><span class="hs-identifier hs-type">index</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-890"></span><span id="index"><span class="annot"><span class="annottext">index :: ByteString -&gt; Int64 -&gt; Word8
</span><a href="Data.ByteString.Lazy.html#index"><span class="hs-identifier hs-var hs-var">index</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>  </span><span id="local-6989586621679075120"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075120"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075120"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Word8
forall a. String -&gt; String -&gt; a
</span><a href="Data.ByteString.Lazy.html#moduleError"><span class="hs-identifier hs-var">moduleError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;index&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;negative index: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075120"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-891"></span><span class="annot"><a href="Data.ByteString.Lazy.html#index"><span class="hs-identifier hs-var">index</span></a></span><span> </span><span id="local-6989586621679075117"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075117"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span id="local-6989586621679075116"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075116"><span class="hs-identifier hs-var">i</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int64 -&gt; Word8
forall {a}. (Show a, Integral a) =&gt; ByteString -&gt; a -&gt; Word8
</span><a href="#local-6989586621679075115"><span class="hs-identifier hs-var">index'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075117"><span class="hs-identifier hs-var">cs0</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075116"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-892"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075115"><span class="annot"><span class="annottext">index' :: ByteString -&gt; a -&gt; Word8
</span><a href="#local-6989586621679075115"><span class="hs-identifier hs-var hs-var">index'</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>     </span><span id="local-6989586621679075100"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075100"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Word8
forall a. String -&gt; String -&gt; a
</span><a href="Data.ByteString.Lazy.html#moduleError"><span class="hs-identifier hs-var">moduleError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;index&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;index too large: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075100"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-893"></span><span>        </span><span class="annot"><a href="#local-6989586621679075115"><span class="hs-identifier hs-var">index'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075099"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075099"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075098"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075098"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679075097"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075097"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-894"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075097"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075099"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-895"></span><span>              </span><span class="annot"><span class="annottext">ByteString -&gt; a -&gt; Word8
</span><a href="#local-6989586621679075115"><span class="hs-identifier hs-var">index'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075098"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075097"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075099"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-896"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeIndex"><span class="hs-identifier hs-var">S.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075099"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075097"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-897"></span><span>
</span><span id="line-898"></span><span class="hs-comment">-- | /O(n)/ The 'elemIndex' function returns the index of the first</span><span>
</span><span id="line-899"></span><span class="hs-comment">-- element in the given 'ByteString' which is equal to the query</span><span>
</span><span id="line-900"></span><span class="hs-comment">-- element, or 'Nothing' if there is no such element.</span><span>
</span><span id="line-901"></span><span class="hs-comment">-- This implementation uses memchr(3).</span><span>
</span><span id="line-902"></span><span class="annot"><a href="Data.ByteString.Lazy.html#elemIndex"><span class="hs-identifier hs-type">elemIndex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-903"></span><span id="elemIndex"><span class="annot"><span class="annottext">elemIndex :: Word8 -&gt; ByteString -&gt; Maybe Int64
</span><a href="Data.ByteString.Lazy.html#elemIndex"><span class="hs-identifier hs-var hs-var">elemIndex</span></a></span></span><span> </span><span id="local-6989586621679075095"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075095"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679075094"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075094"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; ByteString -&gt; Maybe Int64
forall {a}. Num a =&gt; a -&gt; ByteString -&gt; Maybe a
</span><a href="#local-6989586621679075093"><span class="hs-identifier hs-var">elemIndex'</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075094"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-904"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075093"><span class="annot"><span class="annottext">elemIndex' :: a -&gt; ByteString -&gt; Maybe a
</span><a href="#local-6989586621679075093"><span class="hs-identifier hs-var hs-var">elemIndex'</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-905"></span><span>        </span><span class="annot"><a href="#local-6989586621679075093"><span class="hs-identifier hs-var">elemIndex'</span></a></span><span> </span><span id="local-6989586621679075085"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075085"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075084"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075084"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075083"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075083"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-906"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.html#elemIndex"><span class="hs-identifier hs-var">S.elemIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075095"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075084"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-907"></span><span>            </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; ByteString -&gt; Maybe a
</span><a href="#local-6989586621679075093"><span class="hs-identifier hs-var">elemIndex'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075085"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075084"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075083"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-908"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679075081"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075081"><span class="hs-identifier hs-var">i</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075085"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075081"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-909"></span><span>
</span><span id="line-910"></span><span class="hs-comment">-- | /O(n)/ The 'elemIndexEnd' function returns the last index of the</span><span>
</span><span id="line-911"></span><span class="hs-comment">-- element in the given 'ByteString' which is equal to the query</span><span>
</span><span id="line-912"></span><span class="hs-comment">-- element, or 'Nothing' if there is no such element. The following</span><span>
</span><span id="line-913"></span><span class="hs-comment">-- holds:</span><span>
</span><span id="line-914"></span><span class="hs-comment">--</span><span>
</span><span id="line-915"></span><span class="hs-comment">-- &gt; elemIndexEnd c xs ==</span><span>
</span><span id="line-916"></span><span class="hs-comment">-- &gt; (-) (length xs - 1) `fmap` elemIndex c (reverse xs)</span><span>
</span><span id="line-917"></span><span class="hs-comment">--</span><span>
</span><span id="line-918"></span><span class="hs-comment">-- @since 0.10.6.0</span><span>
</span><span id="line-919"></span><span class="annot"><a href="Data.ByteString.Lazy.html#elemIndexEnd"><span class="hs-identifier hs-type">elemIndexEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-920"></span><span id="elemIndexEnd"><span class="annot"><span class="annottext">elemIndexEnd :: Word8 -&gt; ByteString -&gt; Maybe Int64
</span><a href="Data.ByteString.Lazy.html#elemIndexEnd"><span class="hs-identifier hs-var hs-var">elemIndexEnd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Int64
</span><a href="Data.ByteString.Lazy.html#findIndexEnd"><span class="hs-identifier hs-var">findIndexEnd</span></a></span><span> </span><span class="annot"><span class="annottext">((Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Int64)
-&gt; (Word8 -&gt; Word8 -&gt; Bool) -&gt; Word8 -&gt; ByteString -&gt; Maybe Int64
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">(==)</span></a></span><span>
</span><span id="line-921"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#elemIndexEnd"><span class="hs-pragma hs-type">elemIndexEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-922"></span><span>
</span><span id="line-923"></span><span class="hs-comment">-- | /O(n)/ The 'elemIndices' function extends 'elemIndex', by returning</span><span>
</span><span id="line-924"></span><span class="hs-comment">-- the indices of all elements equal to the query element, in ascending order.</span><span>
</span><span id="line-925"></span><span class="hs-comment">-- This implementation uses memchr(3).</span><span>
</span><span id="line-926"></span><span class="annot"><a href="Data.ByteString.Lazy.html#elemIndices"><span class="hs-identifier hs-type">elemIndices</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-927"></span><span id="elemIndices"><span class="annot"><span class="annottext">elemIndices :: Word8 -&gt; ByteString -&gt; [Int64]
</span><a href="Data.ByteString.Lazy.html#elemIndices"><span class="hs-identifier hs-var hs-var">elemIndices</span></a></span></span><span> </span><span id="local-6989586621679075080"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075080"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679075079"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075079"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; ByteString -&gt; [Int64]
forall {a}. Num a =&gt; a -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679075078"><span class="hs-identifier hs-var">elemIndices'</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075079"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-928"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075078"><span class="annot"><span class="annottext">elemIndices' :: a -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679075078"><span class="hs-identifier hs-var hs-var">elemIndices'</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-929"></span><span>        </span><span class="annot"><a href="#local-6989586621679075078"><span class="hs-identifier hs-var">elemIndices'</span></a></span><span> </span><span id="local-6989586621679075070"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075070"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075069"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075069"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075068"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075068"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; a) -&gt; [Int] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075070"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; (Int -&gt; a) -&gt; Int -&gt; a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; [Int]
</span><a href="Data.ByteString.html#elemIndices"><span class="hs-identifier hs-var">S.elemIndices</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075080"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075069"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-930"></span><span>                             </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679075078"><span class="hs-identifier hs-var">elemIndices'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075070"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075069"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075068"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-931"></span><span>
</span><span id="line-932"></span><span class="hs-comment">-- | count returns the number of times its argument appears in the ByteString</span><span>
</span><span id="line-933"></span><span class="hs-comment">--</span><span>
</span><span id="line-934"></span><span class="hs-comment">-- &gt; count = length . elemIndices</span><span>
</span><span id="line-935"></span><span class="hs-comment">--</span><span>
</span><span id="line-936"></span><span class="hs-comment">-- But more efficiently than using length on the intermediate list.</span><span>
</span><span id="line-937"></span><span class="annot"><a href="Data.ByteString.Lazy.html#count"><span class="hs-identifier hs-type">count</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-938"></span><span id="count"><span class="annot"><span class="annottext">count :: Word8 -&gt; ByteString -&gt; Int64
</span><a href="Data.ByteString.Lazy.html#count"><span class="hs-identifier hs-var hs-var">count</span></a></span></span><span> </span><span id="local-6989586621679075066"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075066"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679075065"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075065"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int64 -&gt; ByteString -&gt; Int64) -&gt; Int64 -&gt; ByteString -&gt; Int64
forall a. (a -&gt; ByteString -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldlChunks"><span class="hs-identifier hs-var">foldlChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679075064"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075064"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679075063"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075063"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679075064"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; Int
</span><a href="Data.ByteString.html#count"><span class="hs-identifier hs-var">S.count</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075066"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075063"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075065"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-939"></span><span>
</span><span id="line-940"></span><span class="hs-comment">-- | The 'findIndex' function takes a predicate and a 'ByteString' and</span><span>
</span><span id="line-941"></span><span class="hs-comment">-- returns the index of the first element in the ByteString</span><span>
</span><span id="line-942"></span><span class="hs-comment">-- satisfying the predicate.</span><span>
</span><span id="line-943"></span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndex"><span class="hs-identifier hs-type">findIndex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-944"></span><span id="findIndex"><span class="annot"><span class="annottext">findIndex :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Int64
</span><a href="Data.ByteString.Lazy.html#findIndex"><span class="hs-identifier hs-var hs-var">findIndex</span></a></span></span><span> </span><span id="local-6989586621679075061"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075061"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679075060"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075060"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; ByteString -&gt; Maybe Int64
forall {a}. Num a =&gt; a -&gt; ByteString -&gt; Maybe a
</span><a href="#local-6989586621679075059"><span class="hs-identifier hs-var">findIndex'</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075060"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-945"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075059"><span class="annot"><span class="annottext">findIndex' :: a -&gt; ByteString -&gt; Maybe a
</span><a href="#local-6989586621679075059"><span class="hs-identifier hs-var hs-var">findIndex'</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-946"></span><span>        </span><span class="annot"><a href="#local-6989586621679075059"><span class="hs-identifier hs-var">findIndex'</span></a></span><span> </span><span id="local-6989586621679075051"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075051"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075050"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075050"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075049"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075049"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-947"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.html#findIndex"><span class="hs-identifier hs-var">S.findIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075061"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075050"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-948"></span><span>            </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; ByteString -&gt; Maybe a
</span><a href="#local-6989586621679075059"><span class="hs-identifier hs-var">findIndex'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075051"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075050"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075049"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-949"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679075047"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075047"><span class="hs-identifier hs-var">i</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075051"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075047"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-950"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndex"><span class="hs-pragma hs-type">findIndex</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-951"></span><span>
</span><span id="line-952"></span><span class="hs-comment">-- | The 'findIndexEnd' function takes a predicate and a 'ByteString' and</span><span>
</span><span id="line-953"></span><span class="hs-comment">-- returns the index of the last element in the ByteString</span><span>
</span><span id="line-954"></span><span class="hs-comment">-- satisfying the predicate.</span><span>
</span><span id="line-955"></span><span class="hs-comment">--</span><span>
</span><span id="line-956"></span><span class="hs-comment">-- @since 0.10.12.0</span><span>
</span><span id="line-957"></span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndexEnd"><span class="hs-identifier hs-type">findIndexEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-958"></span><span id="findIndexEnd"><span class="annot"><span class="annottext">findIndexEnd :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Int64
</span><a href="Data.ByteString.Lazy.html#findIndexEnd"><span class="hs-identifier hs-var hs-var">findIndexEnd</span></a></span></span><span> </span><span id="local-6989586621679075046"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075046"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; Maybe Int64
forall {a}. Num a =&gt; Int -&gt; ByteString -&gt; Maybe a
</span><a href="#local-6989586621679075045"><span class="hs-identifier hs-var">findIndexEnd'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-959"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-960"></span><span>    </span><span id="local-6989586621679075045"><span class="annot"><span class="annottext">findIndexEnd' :: Int -&gt; ByteString -&gt; Maybe a
</span><a href="#local-6989586621679075045"><span class="hs-identifier hs-var hs-var">findIndexEnd'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-961"></span><span>    </span><span class="annot"><a href="#local-6989586621679075045"><span class="hs-identifier hs-var">findIndexEnd'</span></a></span><span> </span><span id="local-6989586621679075041"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075041"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075040"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075040"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075039"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075039"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-962"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679075037"><span class="annot"><span class="annottext">n' :: Int
</span><a href="#local-6989586621679075037"><span class="hs-identifier hs-var hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075041"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075040"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-963"></span><span>          </span><span class="hs-glyph">!</span><span id="local-6989586621679075032"><span class="annot"><span class="annottext">i :: Maybe a
</span><a href="#local-6989586621679075032"><span class="hs-identifier hs-var hs-var">i</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; a) -&gt; Maybe Int -&gt; Maybe a
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; a) -&gt; (Int -&gt; Int) -&gt; Int -&gt; a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075041"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Maybe Int -&gt; Maybe a) -&gt; Maybe Int -&gt; Maybe a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.html#findIndexEnd"><span class="hs-identifier hs-var">S.findIndexEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075046"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075040"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-964"></span><span>      </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; Maybe a
</span><a href="#local-6989586621679075045"><span class="hs-identifier hs-var">findIndexEnd'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679075037"><span class="hs-identifier hs-var">n'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075039"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a -&gt; Maybe a
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a -&gt; m a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-operator hs-var">`mplus`</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679075032"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-965"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndexEnd"><span class="hs-pragma hs-type">findIndexEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-966"></span><span>
</span><span id="line-967"></span><span class="hs-comment">-- | /O(n)/ The 'find' function takes a predicate and a ByteString,</span><span>
</span><span id="line-968"></span><span class="hs-comment">-- and returns the first element in matching the predicate, or 'Nothing'</span><span>
</span><span id="line-969"></span><span class="hs-comment">-- if there is no such element.</span><span>
</span><span id="line-970"></span><span class="hs-comment">--</span><span>
</span><span id="line-971"></span><span class="hs-comment">-- &gt; find f p = case findIndex f p of Just n -&gt; Just (p ! n) ; _ -&gt; Nothing</span><span>
</span><span id="line-972"></span><span class="hs-comment">--</span><span>
</span><span id="line-973"></span><span class="annot"><a href="Data.ByteString.Lazy.html#find"><span class="hs-identifier hs-type">find</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-974"></span><span id="find"><span class="annot"><span class="annottext">find :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Word8
</span><a href="Data.ByteString.Lazy.html#find"><span class="hs-identifier hs-var hs-var">find</span></a></span></span><span> </span><span id="local-6989586621679075030"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075030"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679075029"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075029"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe Word8
</span><a href="#local-6989586621679075028"><span class="hs-identifier hs-var">find'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075029"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-975"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075028"><span class="annot"><span class="annottext">find' :: ByteString -&gt; Maybe Word8
</span><a href="#local-6989586621679075028"><span class="hs-identifier hs-var hs-var">find'</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Word8
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-976"></span><span>        </span><span class="annot"><a href="#local-6989586621679075028"><span class="hs-identifier hs-var">find'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075027"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075027"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075026"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075026"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Word8
</span><a href="Data.ByteString.html#find"><span class="hs-identifier hs-var">S.find</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075030"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075027"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-977"></span><span>            </span><span class="annot"><span class="annottext">Maybe Word8
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe Word8
</span><a href="#local-6989586621679075028"><span class="hs-identifier hs-var">find'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075026"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-978"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679075024"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075024"><span class="hs-identifier hs-var">w</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Maybe Word8
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075024"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-979"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#find"><span class="hs-pragma hs-type">find</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-980"></span><span>
</span><span id="line-981"></span><span class="hs-comment">-- | The 'findIndices' function extends 'findIndex', by returning the</span><span>
</span><span id="line-982"></span><span class="hs-comment">-- indices of all elements satisfying the predicate, in ascending order.</span><span>
</span><span id="line-983"></span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndices"><span class="hs-identifier hs-type">findIndices</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-984"></span><span id="findIndices"><span class="annot"><span class="annottext">findIndices :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; [Int64]
</span><a href="Data.ByteString.Lazy.html#findIndices"><span class="hs-identifier hs-var hs-var">findIndices</span></a></span></span><span> </span><span id="local-6989586621679075023"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075023"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679075022"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075022"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; ByteString -&gt; [Int64]
forall {a}. Num a =&gt; a -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679075021"><span class="hs-identifier hs-var">findIndices'</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075022"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-985"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679075021"><span class="annot"><span class="annottext">findIndices' :: a -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679075021"><span class="hs-identifier hs-var hs-var">findIndices'</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-986"></span><span>        </span><span class="annot"><a href="#local-6989586621679075021"><span class="hs-identifier hs-var">findIndices'</span></a></span><span> </span><span id="local-6989586621679075013"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075013"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075012"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075012"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679075011"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075011"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; a) -&gt; [Int] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075013"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; (Int -&gt; a) -&gt; Int -&gt; a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; [Int]
</span><a href="Data.ByteString.html#findIndices"><span class="hs-identifier hs-var">S.findIndices</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075023"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075012"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-987"></span><span>                             </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679075021"><span class="hs-identifier hs-var">findIndices'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679075013"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075012"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075011"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-988"></span><span>
</span><span id="line-989"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-990"></span><span class="hs-comment">-- Searching ByteStrings</span><span>
</span><span id="line-991"></span><span>
</span><span id="line-992"></span><span class="hs-comment">-- | /O(n)/ 'elem' is the 'ByteString' membership predicate.</span><span>
</span><span id="line-993"></span><span class="annot"><a href="Data.ByteString.Lazy.html#elem"><span class="hs-identifier hs-type">elem</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-994"></span><span id="elem"><span class="annot"><span class="annottext">elem :: Word8 -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#elem"><span class="hs-identifier hs-var hs-var">elem</span></a></span></span><span> </span><span id="local-6989586621679075009"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075009"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679075008"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075008"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; Maybe Int64
</span><a href="Data.ByteString.Lazy.html#elemIndex"><span class="hs-identifier hs-var">elemIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075009"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075008"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><span class="annottext">Maybe Int64
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span> </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Maybe Int64
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-995"></span><span>
</span><span id="line-996"></span><span class="hs-comment">-- | /O(n)/ 'notElem' is the inverse of 'elem'</span><span>
</span><span id="line-997"></span><span class="annot"><a href="Data.ByteString.Lazy.html#notElem"><span class="hs-identifier hs-type">notElem</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-998"></span><span id="notElem"><span class="annot"><span class="annottext">notElem :: Word8 -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#notElem"><span class="hs-identifier hs-var hs-var">notElem</span></a></span></span><span> </span><span id="local-6989586621679075007"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075007"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679075006"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075006"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#elem"><span class="hs-identifier hs-var">elem</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679075007"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075006"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-999"></span><span>
</span><span id="line-1000"></span><span class="hs-comment">-- | /O(n)/ 'filter', applied to a predicate and a ByteString,</span><span>
</span><span id="line-1001"></span><span class="hs-comment">-- returns a ByteString containing those characters that satisfy the</span><span>
</span><span id="line-1002"></span><span class="hs-comment">-- predicate.</span><span>
</span><span id="line-1003"></span><span class="annot"><a href="Data.ByteString.Lazy.html#filter"><span class="hs-identifier hs-type">filter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1004"></span><span id="filter"><span class="annot"><span class="annottext">filter :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#filter"><span class="hs-identifier hs-var hs-var">filter</span></a></span></span><span> </span><span id="local-6989586621679075005"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075005"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679075004"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075004"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679075003"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075004"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1005"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1006"></span><span>        </span><span id="local-6989586621679075003"><span class="annot"><span class="annottext">go :: ByteString -&gt; ByteString
</span><a href="#local-6989586621679075003"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-1007"></span><span>        </span><span class="annot"><a href="#local-6989586621679075003"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679075002"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075002"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679075001"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075001"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#chunk"><span class="hs-identifier hs-var">chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#filter"><span class="hs-identifier hs-var">S.filter</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679075005"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075002"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679075003"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679075001"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1008"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#filter"><span class="hs-pragma hs-type">filter</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1009"></span><span>
</span><span id="line-1010"></span><span class="hs-comment">{-
-- | /O(n)/ and /O(n\/c) space/ A first order equivalent of /filter .
-- (==)/, for the common case of filtering a single byte. It is more
-- efficient to use /filterByte/ in this case.
--
-- &gt; filterByte == filter . (==)
--
-- filterByte is around 10x faster, and uses much less space, than its
-- filter equivalent
filterByte :: Word8 -&gt; ByteString -&gt; ByteString
filterByte w ps = replicate (count w ps) w
{-# INLINE filterByte #-}

{-# RULES
&quot;ByteString specialise filter (== x)&quot; forall x.
  filter ((==) x) = filterByte x

&quot;ByteString specialise filter (== x)&quot; forall x.
 filter (== x) = filterByte x
  #-}
-}</span><span>
</span><span id="line-1031"></span><span>
</span><span id="line-1032"></span><span class="hs-comment">{-
-- | /O(n)/ A first order equivalent of /filter . (\/=)/, for the common
-- case of filtering a single byte out of a list. It is more efficient
-- to use /filterNotByte/ in this case.
--
-- &gt; filterNotByte == filter . (/=)
--
-- filterNotByte is around 2x faster than its filter equivalent.
filterNotByte :: Word8 -&gt; ByteString -&gt; ByteString
filterNotByte w (LPS xs) = LPS (filterMap (P.filterNotByte w) xs)
-}</span><span>
</span><span id="line-1043"></span><span>
</span><span id="line-1044"></span><span class="hs-comment">-- | /O(n)/ The 'partition' function takes a predicate a ByteString and returns</span><span>
</span><span id="line-1045"></span><span class="hs-comment">-- the pair of ByteStrings with elements which do and do not satisfy the</span><span>
</span><span id="line-1046"></span><span class="hs-comment">-- predicate, respectively; i.e.,</span><span>
</span><span id="line-1047"></span><span class="hs-comment">--</span><span>
</span><span id="line-1048"></span><span class="hs-comment">-- &gt; partition p bs == (filter p xs, filter (not . p) xs)</span><span>
</span><span id="line-1049"></span><span class="hs-comment">--</span><span>
</span><span id="line-1050"></span><span class="annot"><a href="Data.ByteString.Lazy.html#partition"><span class="hs-identifier hs-type">partition</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1051"></span><span id="partition"><span class="annot"><span class="annottext">partition :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Lazy.html#partition"><span class="hs-identifier hs-var hs-var">partition</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1052"></span><span class="annot"><a href="Data.ByteString.Lazy.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span id="local-6989586621679074999"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679074999"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074998"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074998"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679074997"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074997"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#chunk"><span class="hs-identifier hs-var">chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074996"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074995"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#chunk"><span class="hs-identifier hs-var">chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074994"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074993"><span class="hs-identifier hs-var">fs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1053"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1054"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679074996"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074996"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span>   </span><span id="local-6989586621679074994"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074994"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.html#partition"><span class="hs-identifier hs-var">S.partition</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679074999"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074998"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1055"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679074995"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074995"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679074993"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074993"><span class="hs-identifier hs-var">fs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Lazy.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span>   </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679074999"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074997"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1056"></span><span>
</span><span id="line-1057"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-1058"></span><span class="hs-comment">-- Searching for substrings</span><span>
</span><span id="line-1059"></span><span>
</span><span id="line-1060"></span><span class="hs-comment">-- | /O(n)/ The 'isPrefixOf' function takes two ByteStrings and returns 'True'</span><span>
</span><span id="line-1061"></span><span class="hs-comment">-- iff the first is a prefix of the second.</span><span>
</span><span id="line-1062"></span><span class="annot"><a href="Data.ByteString.Lazy.html#isPrefixOf"><span class="hs-identifier hs-type">isPrefixOf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-1063"></span><span id="isPrefixOf"><span class="annot"><span class="annottext">isPrefixOf :: ByteString -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#isPrefixOf"><span class="hs-identifier hs-var hs-var">isPrefixOf</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-1064"></span><span class="annot"><a href="Data.ByteString.Lazy.html#isPrefixOf"><span class="hs-identifier hs-var">isPrefixOf</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-1065"></span><span class="annot"><a href="Data.ByteString.Lazy.html#isPrefixOf"><span class="hs-identifier hs-var">isPrefixOf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074991"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074991"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679074990"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074990"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074989"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074989"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679074988"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074988"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1066"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074991"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074989"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074991"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074989"><span class="hs-identifier hs-var">y</span></a></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#isPrefixOf"><span class="hs-identifier hs-var">isPrefixOf</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074990"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074988"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1067"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074991"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span>  </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074989"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074991"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074987"><span class="hs-identifier hs-var">yh</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#isPrefixOf"><span class="hs-identifier hs-var">isPrefixOf</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074990"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074986"><span class="hs-identifier hs-var">yt</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074988"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1068"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074985"><span class="hs-identifier hs-var">xh</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074989"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#isPrefixOf"><span class="hs-identifier hs-var">isPrefixOf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074984"><span class="hs-identifier hs-var">xt</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074990"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074988"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1069"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679074985"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074985"><span class="hs-identifier hs-var">xh</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679074984"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074984"><span class="hs-identifier hs-var">xt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.html#splitAt"><span class="hs-identifier hs-var">S.splitAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074989"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074991"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1070"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679074987"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074987"><span class="hs-identifier hs-var">yh</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679074986"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074986"><span class="hs-identifier hs-var">yt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.html#splitAt"><span class="hs-identifier hs-var">S.splitAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074991"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074989"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1071"></span><span>
</span><span id="line-1072"></span><span class="hs-comment">-- | /O(n)/ The 'stripPrefix' function takes two ByteStrings and returns 'Just'</span><span>
</span><span id="line-1073"></span><span class="hs-comment">-- the remainder of the second iff the first is its prefix, and otherwise</span><span>
</span><span id="line-1074"></span><span class="hs-comment">-- 'Nothing'.</span><span>
</span><span id="line-1075"></span><span class="hs-comment">--</span><span>
</span><span id="line-1076"></span><span class="hs-comment">-- @since 0.10.8.0</span><span>
</span><span id="line-1077"></span><span class="annot"><a href="Data.ByteString.Lazy.html#stripPrefix"><span class="hs-identifier hs-type">stripPrefix</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1078"></span><span id="stripPrefix"><span class="annot"><span class="annottext">stripPrefix :: ByteString -&gt; ByteString -&gt; Maybe ByteString
</span><a href="Data.ByteString.Lazy.html#stripPrefix"><span class="hs-identifier hs-var hs-var">stripPrefix</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span id="local-6989586621679074982"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074982"><span class="hs-identifier hs-var">bs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe ByteString
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074982"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-1079"></span><span class="annot"><a href="Data.ByteString.Lazy.html#stripPrefix"><span class="hs-identifier hs-var">stripPrefix</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe ByteString
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1080"></span><span class="annot"><a href="Data.ByteString.Lazy.html#stripPrefix"><span class="hs-identifier hs-var">stripPrefix</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074981"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074981"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679074980"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074980"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074979"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074979"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679074978"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074978"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1081"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074981"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074979"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074981"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074979"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Maybe ByteString
</span><a href="Data.ByteString.Lazy.html#stripPrefix"><span class="hs-identifier hs-var">stripPrefix</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074980"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074978"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Maybe ByteString
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1082"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074981"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span>  </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074979"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679074977"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074977"><span class="hs-identifier hs-var">yt</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Maybe ByteString
</span><a href="Data.ByteString.html#stripPrefix"><span class="hs-identifier hs-var">S.stripPrefix</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074981"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074979"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1083"></span><span>                                    </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Maybe ByteString
</span><a href="Data.ByteString.Lazy.html#stripPrefix"><span class="hs-identifier hs-var">stripPrefix</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074980"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074977"><span class="hs-identifier hs-var">yt</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074978"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1084"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679074975"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074975"><span class="hs-identifier hs-var">xt</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Maybe ByteString
</span><a href="Data.ByteString.html#stripPrefix"><span class="hs-identifier hs-var">S.stripPrefix</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074979"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074981"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1085"></span><span>                                    </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Maybe ByteString
</span><a href="Data.ByteString.Lazy.html#stripPrefix"><span class="hs-identifier hs-var">stripPrefix</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074975"><span class="hs-identifier hs-var">xt</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074980"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074978"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1086"></span><span>
</span><span id="line-1087"></span><span class="hs-comment">-- | /O(n)/ The 'isSuffixOf' function takes two ByteStrings and returns 'True'</span><span>
</span><span id="line-1088"></span><span class="hs-comment">-- iff the first is a suffix of the second.</span><span>
</span><span id="line-1089"></span><span class="hs-comment">--</span><span>
</span><span id="line-1090"></span><span class="hs-comment">-- The following holds:</span><span>
</span><span id="line-1091"></span><span class="hs-comment">--</span><span>
</span><span id="line-1092"></span><span class="hs-comment">-- &gt; isSuffixOf x y == reverse x `isPrefixOf` reverse y</span><span>
</span><span id="line-1093"></span><span class="hs-comment">--</span><span>
</span><span id="line-1094"></span><span class="annot"><a href="Data.ByteString.Lazy.html#isSuffixOf"><span class="hs-identifier hs-type">isSuffixOf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-1095"></span><span id="isSuffixOf"><span class="annot"><span class="annottext">isSuffixOf :: ByteString -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#isSuffixOf"><span class="hs-identifier hs-var hs-var">isSuffixOf</span></a></span></span><span> </span><span id="local-6989586621679074974"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074974"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679074973"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074973"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074974"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Lazy.html#isPrefixOf"><span class="hs-operator hs-var">`isPrefixOf`</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074973"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1096"></span><span class="hs-comment">--TODO: a better implementation</span><span>
</span><span id="line-1097"></span><span>
</span><span id="line-1098"></span><span class="hs-comment">-- | /O(n)/ The 'stripSuffix' function takes two ByteStrings and returns 'Just'</span><span>
</span><span id="line-1099"></span><span class="hs-comment">-- the remainder of the second iff the first is its suffix, and otherwise</span><span>
</span><span id="line-1100"></span><span class="hs-comment">-- 'Nothing'.</span><span>
</span><span id="line-1101"></span><span class="annot"><a href="Data.ByteString.Lazy.html#stripSuffix"><span class="hs-identifier hs-type">stripSuffix</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1102"></span><span id="stripSuffix"><span class="annot"><span class="annottext">stripSuffix :: ByteString -&gt; ByteString -&gt; Maybe ByteString
</span><a href="Data.ByteString.Lazy.html#stripSuffix"><span class="hs-identifier hs-var hs-var">stripSuffix</span></a></span></span><span> </span><span id="local-6989586621679074972"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074972"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679074971"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074971"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString) -&gt; Maybe ByteString -&gt; Maybe ByteString
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Maybe ByteString
</span><a href="Data.ByteString.Lazy.html#stripPrefix"><span class="hs-identifier hs-var">stripPrefix</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074972"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074971"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1103"></span><span class="hs-comment">--TODO: a better implementation</span><span>
</span><span id="line-1104"></span><span>
</span><span id="line-1105"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-1106"></span><span class="hs-comment">-- Zipping</span><span>
</span><span id="line-1107"></span><span>
</span><span id="line-1108"></span><span class="hs-comment">-- | /O(n)/ 'zip' takes two ByteStrings and returns a list of</span><span>
</span><span id="line-1109"></span><span class="hs-comment">-- corresponding pairs of bytes. If one input ByteString is short,</span><span>
</span><span id="line-1110"></span><span class="hs-comment">-- excess elements of the longer ByteString are discarded. This is</span><span>
</span><span id="line-1111"></span><span class="hs-comment">-- equivalent to a pair of 'unpack' operations.</span><span>
</span><span id="line-1112"></span><span class="annot"><a href="Data.ByteString.Lazy.html#zip"><span class="hs-identifier hs-type">zip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1113"></span><span id="zip"><span class="annot"><span class="annottext">zip :: ByteString -&gt; ByteString -&gt; [(Word8, Word8)]
</span><a href="Data.ByteString.Lazy.html#zip"><span class="hs-identifier hs-var hs-var">zip</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; (Word8, Word8))
-&gt; ByteString -&gt; ByteString -&gt; [(Word8, Word8)]
forall a. (Word8 -&gt; Word8 -&gt; a) -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="Data.ByteString.Lazy.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">,</span><span class="hs-special">)</span><span>
</span><span id="line-1114"></span><span>
</span><span id="line-1115"></span><span class="hs-comment">-- | 'zipWith' generalises 'zip' by zipping with the function given as</span><span>
</span><span id="line-1116"></span><span class="hs-comment">-- the first argument, instead of a tupling function.  For example,</span><span>
</span><span id="line-1117"></span><span class="hs-comment">-- @'zipWith' (+)@ is applied to two ByteStrings to produce the list of</span><span>
</span><span id="line-1118"></span><span class="hs-comment">-- corresponding sums.</span><span>
</span><span id="line-1119"></span><span id="local-6989586621679075874"><span class="annot"><a href="Data.ByteString.Lazy.html#zipWith"><span class="hs-identifier hs-type">zipWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075874"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679075874"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1120"></span><span id="zipWith"><span class="annot"><span class="annottext">zipWith :: forall a. (Word8 -&gt; Word8 -&gt; a) -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="Data.ByteString.Lazy.html#zipWith"><span class="hs-identifier hs-var hs-var">zipWith</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>     </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1121"></span><span class="annot"><a href="Data.ByteString.Lazy.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1122"></span><span class="annot"><a href="Data.ByteString.Lazy.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span id="local-6989586621679074969"><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; a
</span><a href="#local-6989586621679074969"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074968"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074968"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679074967"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074967"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074966"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074966"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679074965"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074965"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679074964"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074968"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074967"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074966"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074965"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-1123"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1124"></span><span>    </span><span id="local-6989586621679074964"><span class="annot"><span class="annottext">go :: ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679074964"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679074963"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074963"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679074962"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074962"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679074961"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074961"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679074960"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074960"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; a
</span><a href="#local-6989586621679074969"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074963"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">S.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074961"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1125"></span><span>                 </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679074959"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074963"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074962"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074961"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074960"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1126"></span><span>
</span><span id="line-1127"></span><span>    </span><span id="local-6989586621679074959"><span class="annot"><span class="annottext">to :: ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679074959"><span class="hs-identifier hs-var hs-var">to</span></a></span></span><span> </span><span id="local-6989586621679074958"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074958"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>         </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074958"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1128"></span><span>    </span><span class="annot"><a href="#local-6989586621679074959"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span>             </span><span id="local-6989586621679074957"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074957"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074957"><span class="hs-identifier hs-var">y</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1129"></span><span>    </span><span class="annot"><a href="#local-6989586621679074959"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span id="local-6989586621679074956"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074956"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679074955"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074955"><span class="hs-identifier hs-var">xs</span></a></span></span><span>            </span><span id="local-6989586621679074954"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074954"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679074953"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074953"><span class="hs-identifier hs-var">ys</span></a></span></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074956"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1130"></span><span>                                      </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074954"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679074964"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074956"><span class="hs-identifier hs-var">x</span></a></span><span>  </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074955"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074954"><span class="hs-identifier hs-var">y</span></a></span><span>  </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074953"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1131"></span><span>    </span><span class="annot"><a href="#local-6989586621679074959"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span id="local-6989586621679074952"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074952"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679074951"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074951"><span class="hs-identifier hs-var">xs</span></a></span></span><span>            </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074950"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074950"><span class="hs-identifier hs-var">y'</span></a></span></span><span> </span><span id="local-6989586621679074949"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074949"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074952"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679074964"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074952"><span class="hs-identifier hs-var">x</span></a></span><span>  </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074951"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074950"><span class="hs-identifier hs-var">y'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074949"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1132"></span><span>    </span><span class="annot"><a href="#local-6989586621679074959"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074948"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074948"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span id="local-6989586621679074947"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074947"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679074946"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074946"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679074945"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074945"><span class="hs-identifier hs-var">ys</span></a></span></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074946"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679074964"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074948"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074947"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074946"><span class="hs-identifier hs-var">y</span></a></span><span>  </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074945"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1133"></span><span>    </span><span class="annot"><a href="#local-6989586621679074959"><span class="hs-identifier hs-var">to</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074944"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074944"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span id="local-6989586621679074943"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074943"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074942"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074942"><span class="hs-identifier hs-var">y'</span></a></span></span><span> </span><span id="local-6989586621679074941"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074941"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="#local-6989586621679074964"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074944"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074943"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074942"><span class="hs-identifier hs-var">y'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074941"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1134"></span><span>
</span><span id="line-1135"></span><span class="hs-comment">-- | /O(n)/ 'unzip' transforms a list of pairs of bytes into a pair of</span><span>
</span><span id="line-1136"></span><span class="hs-comment">-- ByteStrings. Note that this performs two 'pack' operations.</span><span>
</span><span id="line-1137"></span><span class="annot"><a href="Data.ByteString.Lazy.html#unzip"><span class="hs-identifier hs-type">unzip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1138"></span><span id="unzip"><span class="annot"><span class="annottext">unzip :: [(Word8, Word8)] -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Lazy.html#unzip"><span class="hs-identifier hs-var hs-var">unzip</span></a></span></span><span> </span><span id="local-6989586621679074940"><span class="annot"><span class="annottext">[(Word8, Word8)]
</span><a href="#local-6989586621679074940"><span class="hs-identifier hs-var">ls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Word8] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Word8, Word8) -&gt; Word8) -&gt; [(Word8, Word8)] -&gt; [Word8]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8, Word8) -&gt; Word8
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Word8, Word8)]
</span><a href="#local-6989586621679074940"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Word8] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Word8, Word8) -&gt; Word8) -&gt; [(Word8, Word8)] -&gt; [Word8]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8, Word8) -&gt; Word8
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(Word8, Word8)]
</span><a href="#local-6989586621679074940"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1139"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#unzip"><span class="hs-pragma hs-type">unzip</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1140"></span><span>
</span><span id="line-1141"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-1142"></span><span class="hs-comment">-- Special lists</span><span>
</span><span id="line-1143"></span><span>
</span><span id="line-1144"></span><span class="hs-comment">-- | /O(n)/ Return all initial segments of the given 'ByteString', shortest first.</span><span>
</span><span id="line-1145"></span><span class="annot"><a href="Data.ByteString.Lazy.html#inits"><span class="hs-identifier hs-type">inits</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1146"></span><span id="inits"><span class="annot"><span class="annottext">inits :: ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#inits"><span class="hs-identifier hs-var hs-var">inits</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([ByteString] -&gt; [ByteString])
-&gt; (ByteString -&gt; [ByteString]) -&gt; ByteString -&gt; [ByteString]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679074939"><span class="hs-identifier hs-var">inits'</span></a></span><span>
</span><span id="line-1147"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679074939"><span class="annot"><span class="annottext">inits' :: ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679074939"><span class="hs-identifier hs-var hs-var">inits'</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1148"></span><span>        </span><span class="annot"><a href="#local-6989586621679074939"><span class="hs-identifier hs-var">inits'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074938"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074938"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679074937"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074937"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString) -&gt; [ByteString] -&gt; [ByteString]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-operator hs-var">`Chunk`</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ByteString] -&gt; [ByteString]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#tail"><span class="hs-identifier hs-var">L.tail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.html#inits"><span class="hs-identifier hs-var">S.inits</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074938"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1149"></span><span>                           </span><span class="annot"><span class="annottext">[ByteString] -&gt; [ByteString] -&gt; [ByteString]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString) -&gt; [ByteString] -&gt; [ByteString]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074938"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="#local-6989586621679074939"><span class="hs-identifier hs-var">inits'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074937"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1150"></span><span>
</span><span id="line-1151"></span><span class="hs-comment">-- | /O(n)/ Return all final segments of the given 'ByteString', longest first.</span><span>
</span><span id="line-1152"></span><span class="annot"><a href="Data.ByteString.Lazy.html#tails"><span class="hs-identifier hs-type">tails</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1153"></span><span id="tails"><span class="annot"><span class="annottext">tails :: ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#tails"><span class="hs-identifier hs-var hs-var">tails</span></a></span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1154"></span><span class="annot"><a href="Data.ByteString.Lazy.html#tails"><span class="hs-identifier hs-var">tails</span></a></span><span> </span><span id="local-6989586621679074935"><span class="annot"><span class="annottext">cs :: ByteString
</span><a href="#local-6989586621679074935"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074934"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074934"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679074933"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074933"><span class="hs-identifier hs-var">cs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1155"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074934"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074935"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#tails"><span class="hs-identifier hs-var">tails</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074933"><span class="hs-identifier hs-var">cs'</span></a></span><span>
</span><span id="line-1156"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074935"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Lazy.html#tails"><span class="hs-identifier hs-var">tails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">S.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074934"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074933"><span class="hs-identifier hs-var">cs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1157"></span><span>
</span><span id="line-1158"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-1159"></span><span class="hs-comment">-- Low level constructors</span><span>
</span><span id="line-1160"></span><span>
</span><span id="line-1161"></span><span class="hs-comment">-- | /O(n)/ Make a copy of the 'ByteString' with its own storage.</span><span>
</span><span id="line-1162"></span><span class="hs-comment">--   This is mainly useful to allow the rest of the data pointed</span><span>
</span><span id="line-1163"></span><span class="hs-comment">--   to by the 'ByteString' to be garbage collected, for example</span><span>
</span><span id="line-1164"></span><span class="hs-comment">--   if a large string has been read in, and only a small part of it</span><span>
</span><span id="line-1165"></span><span class="hs-comment">--   is needed in the rest of the program.</span><span>
</span><span id="line-1166"></span><span class="annot"><a href="Data.ByteString.Lazy.html#copy"><span class="hs-identifier hs-type">copy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1167"></span><span id="copy"><span class="annot"><span class="annottext">copy :: ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#copy"><span class="hs-identifier hs-var hs-var">copy</span></a></span></span><span> </span><span id="local-6989586621679074932"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074932"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; ByteString -&gt; ByteString -&gt; ByteString
forall a. (ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier hs-var">foldrChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; (ByteString -&gt; ByteString)
-&gt; ByteString
-&gt; ByteString
-&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#copy"><span class="hs-identifier hs-var">S.copy</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074932"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1168"></span><span class="hs-comment">--TODO, we could coalese small blocks here</span><span>
</span><span id="line-1169"></span><span class="hs-comment">--FIXME: probably not strict enough, if we're doing this to avoid retaining</span><span>
</span><span id="line-1170"></span><span class="hs-comment">-- the parent blocks then we'd better copy strictly.</span><span>
</span><span id="line-1171"></span><span>
</span><span id="line-1172"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-1173"></span><span>
</span><span id="line-1174"></span><span class="hs-comment">-- TODO defrag func that concatenates block together that are below a threshold</span><span>
</span><span id="line-1175"></span><span class="hs-comment">-- defrag :: ByteString -&gt; ByteString</span><span>
</span><span id="line-1176"></span><span>
</span><span id="line-1177"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-1178"></span><span class="hs-comment">-- Lazy ByteString IO</span><span>
</span><span id="line-1179"></span><span class="hs-comment">--</span><span>
</span><span id="line-1180"></span><span class="hs-comment">-- Rule for when to close: is it expected to read the whole file?</span><span>
</span><span id="line-1181"></span><span class="hs-comment">-- If so, close when done.</span><span>
</span><span id="line-1182"></span><span class="hs-comment">--</span><span>
</span><span id="line-1183"></span><span>
</span><span id="line-1184"></span><span class="hs-comment">-- | Read entire handle contents /lazily/ into a 'ByteString'. Chunks</span><span>
</span><span id="line-1185"></span><span class="hs-comment">-- are read on demand, in at most @k@-sized chunks. It does not block</span><span>
</span><span id="line-1186"></span><span class="hs-comment">-- waiting for a whole @k@-sized chunk, so if less than @k@ bytes are</span><span>
</span><span id="line-1187"></span><span class="hs-comment">-- available then they will be returned immediately as a smaller chunk.</span><span>
</span><span id="line-1188"></span><span class="hs-comment">--</span><span>
</span><span id="line-1189"></span><span class="hs-comment">-- The handle is closed on EOF.</span><span>
</span><span id="line-1190"></span><span class="hs-comment">--</span><span>
</span><span id="line-1191"></span><span class="hs-comment">-- Note: the 'Handle' should be placed in binary mode with</span><span>
</span><span id="line-1192"></span><span class="hs-comment">-- 'System.IO.hSetBinaryMode' for 'hGetContentsN' to</span><span>
</span><span id="line-1193"></span><span class="hs-comment">-- work correctly.</span><span>
</span><span id="line-1194"></span><span class="hs-comment">--</span><span>
</span><span id="line-1195"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetContentsN"><span class="hs-identifier hs-type">hGetContentsN</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1196"></span><span id="hGetContentsN"><span class="annot"><span class="annottext">hGetContentsN :: Int -&gt; Handle -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetContentsN"><span class="hs-identifier hs-var hs-var">hGetContentsN</span></a></span></span><span> </span><span id="local-6989586621679074929"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074929"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679074928"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074928"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO ByteString
</span><a href="#local-6989586621679074927"><span class="hs-identifier hs-var">lazyRead</span></a></span><span> </span><span class="hs-comment">-- TODO close on exceptions</span><span>
</span><span id="line-1197"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1198"></span><span>    </span><span id="local-6989586621679074927"><span class="annot"><span class="annottext">lazyRead :: IO ByteString
</span><a href="#local-6989586621679074927"><span class="hs-identifier hs-var hs-var">lazyRead</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO ByteString -&gt; IO ByteString
forall a. IO a -&gt; IO a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafeInterleaveIO"><span class="hs-identifier hs-var">unsafeInterleaveIO</span></a></span><span> </span><span class="annot"><span class="annottext">IO ByteString
</span><a href="#local-6989586621679074920"><span class="hs-identifier hs-var">loop</span></a></span><span>
</span><span id="line-1199"></span><span>
</span><span id="line-1200"></span><span>    </span><span id="local-6989586621679074920"><span class="annot"><span class="annottext">loop :: IO ByteString
</span><a href="#local-6989586621679074920"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1201"></span><span>        </span><span id="local-6989586621679074919"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074919"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; Int -&gt; IO ByteString
</span><a href="Data.ByteString.html#hGetSome"><span class="hs-identifier hs-var">S.hGetSome</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074928"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074929"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-comment">-- only blocks if there is no data available</span><span>
</span><span id="line-1202"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074919"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-1203"></span><span>          </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.html#hClose"><span class="hs-identifier hs-var">hClose</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074928"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-1204"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679074917"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074917"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO ByteString
</span><a href="#local-6989586621679074927"><span class="hs-identifier hs-var">lazyRead</span></a></span><span>
</span><span id="line-1205"></span><span>                  </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074919"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074917"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1206"></span><span>
</span><span id="line-1207"></span><span class="hs-comment">-- | Read @n@ bytes into a 'ByteString', directly from the</span><span>
</span><span id="line-1208"></span><span class="hs-comment">-- specified 'Handle', in chunks of size @k@.</span><span>
</span><span id="line-1209"></span><span class="hs-comment">--</span><span>
</span><span id="line-1210"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetN"><span class="hs-identifier hs-type">hGetN</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1211"></span><span id="hGetN"><span class="annot"><span class="annottext">hGetN :: Int -&gt; Handle -&gt; Int -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetN"><span class="hs-identifier hs-var hs-var">hGetN</span></a></span></span><span> </span><span id="local-6989586621679074915"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074915"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679074914"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074914"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span id="local-6989586621679074913"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074913"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074913"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO ByteString
</span><a href="#local-6989586621679074911"><span class="hs-identifier hs-var">readChunks</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074913"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1212"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1213"></span><span>    </span><span id="local-6989586621679074911"><span class="annot"><span class="annottext">readChunks :: Int -&gt; IO ByteString
</span><a href="#local-6989586621679074911"><span class="hs-identifier hs-var hs-var">readChunks</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679074902"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074902"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1214"></span><span>        </span><span id="local-6989586621679074901"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074901"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; Int -&gt; IO ByteString
</span><a href="Data.ByteString.html#hGet"><span class="hs-identifier hs-var">S.hGet</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074914"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><a href="../../ghc-prim/src/GHC.Classes.html#min"><span class="hs-identifier hs-var">min</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074915"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074902"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1215"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074901"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1216"></span><span>            </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-1217"></span><span>            </span><span id="local-6989586621679074899"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074899"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679074898"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074898"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO ByteString
</span><a href="#local-6989586621679074911"><span class="hs-identifier hs-var">readChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074902"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074899"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1218"></span><span>                    </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074901"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074898"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1219"></span><span>
</span><span id="line-1220"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetN"><span class="hs-identifier hs-var">hGetN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Handle
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-1221"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetN"><span class="hs-identifier hs-var">hGetN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679074897"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074897"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span id="local-6989586621679074896"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074896"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; String -&gt; Int -&gt; IO ByteString
forall a. Handle -&gt; String -&gt; Int -&gt; IO a
</span><a href="Data.ByteString.Lazy.html#illegalBufferSize"><span class="hs-identifier hs-var">illegalBufferSize</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074897"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;hGet&quot;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074896"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1222"></span><span>
</span><span id="line-1223"></span><span class="hs-comment">-- | hGetNonBlockingN is similar to 'hGetContentsN', except that it will never block</span><span>
</span><span id="line-1224"></span><span class="hs-comment">-- waiting for data to become available, instead it returns only whatever data</span><span>
</span><span id="line-1225"></span><span class="hs-comment">-- is available. Chunks are read on demand, in @k@-sized chunks.</span><span>
</span><span id="line-1226"></span><span class="hs-comment">--</span><span>
</span><span id="line-1227"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetNonBlockingN"><span class="hs-identifier hs-type">hGetNonBlockingN</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1228"></span><span id="hGetNonBlockingN"><span class="annot"><span class="annottext">hGetNonBlockingN :: Int -&gt; Handle -&gt; Int -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetNonBlockingN"><span class="hs-identifier hs-var hs-var">hGetNonBlockingN</span></a></span></span><span> </span><span id="local-6989586621679074893"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074893"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679074892"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074892"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span id="local-6989586621679074891"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074891"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074891"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO ByteString
</span><a href="#local-6989586621679074890"><span class="hs-identifier hs-var">readChunks</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074891"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1229"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1230"></span><span>    </span><span id="local-6989586621679074890"><span class="annot"><span class="annottext">readChunks :: Int -&gt; IO ByteString
</span><a href="#local-6989586621679074890"><span class="hs-identifier hs-var hs-var">readChunks</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679074881"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074881"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1231"></span><span>        </span><span id="local-6989586621679074880"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074880"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; Int -&gt; IO ByteString
</span><a href="Data.ByteString.html#hGetNonBlocking"><span class="hs-identifier hs-var">S.hGetNonBlocking</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074892"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><a href="../../ghc-prim/src/GHC.Classes.html#min"><span class="hs-identifier hs-var">min</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074881"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1232"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074880"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1233"></span><span>            </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-1234"></span><span>            </span><span id="local-6989586621679074878"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074878"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679074877"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074877"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO ByteString
</span><a href="#local-6989586621679074890"><span class="hs-identifier hs-var">readChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074881"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074878"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1235"></span><span>                    </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074880"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074877"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1236"></span><span>
</span><span id="line-1237"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetNonBlockingN"><span class="hs-identifier hs-var">hGetNonBlockingN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Handle
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-1238"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetNonBlockingN"><span class="hs-identifier hs-var">hGetNonBlockingN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679074876"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074876"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span id="local-6989586621679074875"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074875"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; String -&gt; Int -&gt; IO ByteString
forall a. Handle -&gt; String -&gt; Int -&gt; IO a
</span><a href="Data.ByteString.Lazy.html#illegalBufferSize"><span class="hs-identifier hs-var">illegalBufferSize</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074876"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;hGetNonBlocking&quot;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074875"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1239"></span><span>
</span><span id="line-1240"></span><span id="local-6989586621679075864"><span class="annot"><a href="Data.ByteString.Lazy.html#illegalBufferSize"><span class="hs-identifier hs-type">illegalBufferSize</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679075864"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1241"></span><span id="illegalBufferSize"><span class="annot"><span class="annottext">illegalBufferSize :: forall a. Handle -&gt; String -&gt; Int -&gt; IO a
</span><a href="Data.ByteString.Lazy.html#illegalBufferSize"><span class="hs-identifier hs-var hs-var">illegalBufferSize</span></a></span></span><span> </span><span id="local-6989586621679074874"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074874"><span class="hs-identifier hs-var">handle</span></a></span></span><span> </span><span id="local-6989586621679074873"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074873"><span class="hs-identifier hs-var">fn</span></a></span></span><span> </span><span id="local-6989586621679074872"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074872"><span class="hs-identifier hs-var">sz</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1242"></span><span>    </span><span class="annot"><span class="annottext">IOError -&gt; IO a
forall a. IOError -&gt; IO a
</span><a href="../../base/src/GHC.IO.Exception.html#ioError"><span class="hs-identifier hs-var">ioError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IOErrorType -&gt; String -&gt; Maybe Handle -&gt; Maybe String -&gt; IOError
</span><a href="../../base/src/System.IO.Error.html#mkIOError"><span class="hs-identifier hs-var">mkIOError</span></a></span><span> </span><span class="annot"><span class="annottext">IOErrorType
</span><a href="../../base/src/System.IO.Error.html#illegalOperationErrorType"><span class="hs-identifier hs-var">illegalOperationErrorType</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074870"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Handle -&gt; Maybe Handle
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074874"><span class="hs-identifier hs-var">handle</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1243"></span><span>    </span><span class="hs-comment">--TODO: System.IO uses InvalidArgument here, but it's not exported :-(</span><span>
</span><span id="line-1244"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1245"></span><span>      </span><span id="local-6989586621679074870"><span class="annot"><span class="annottext">msg :: String
</span><a href="#local-6989586621679074870"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074873"><span class="hs-identifier hs-var">fn</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: illegal ByteString size &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; String -&gt; String
forall a. Show a =&gt; Int -&gt; a -&gt; String -&gt; String
</span><a href="../../base/src/GHC.Show.html#showsPrec"><span class="hs-identifier hs-var">showsPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">9</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074872"><span class="hs-identifier hs-var">sz</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1246"></span><span>
</span><span id="line-1247"></span><span class="hs-comment">-- | Read entire handle contents /lazily/ into a 'ByteString'. Chunks</span><span>
</span><span id="line-1248"></span><span class="hs-comment">-- are read on demand, using the default chunk size.</span><span>
</span><span id="line-1249"></span><span class="hs-comment">--</span><span>
</span><span id="line-1250"></span><span class="hs-comment">-- Once EOF is encountered, the Handle is closed.</span><span>
</span><span id="line-1251"></span><span class="hs-comment">--</span><span>
</span><span id="line-1252"></span><span class="hs-comment">-- Note: the 'Handle' should be placed in binary mode with</span><span>
</span><span id="line-1253"></span><span class="hs-comment">-- 'System.IO.hSetBinaryMode' for 'hGetContents' to</span><span>
</span><span id="line-1254"></span><span class="hs-comment">-- work correctly.</span><span>
</span><span id="line-1255"></span><span class="hs-comment">--</span><span>
</span><span id="line-1256"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetContents"><span class="hs-identifier hs-type">hGetContents</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1257"></span><span id="hGetContents"><span class="annot"><span class="annottext">hGetContents :: Handle -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetContents"><span class="hs-identifier hs-var hs-var">hGetContents</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Handle -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetContentsN"><span class="hs-identifier hs-var">hGetContentsN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.ByteString.Lazy.Internal.html#defaultChunkSize"><span class="hs-identifier hs-var">defaultChunkSize</span></a></span><span>
</span><span id="line-1258"></span><span>
</span><span id="line-1259"></span><span class="hs-comment">-- | Read @n@ bytes into a 'ByteString', directly from the specified 'Handle'.</span><span>
</span><span id="line-1260"></span><span class="hs-comment">--</span><span>
</span><span id="line-1261"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGet"><span class="hs-identifier hs-type">hGet</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1262"></span><span id="hGet"><span class="annot"><span class="annottext">hGet :: Handle -&gt; Int -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGet"><span class="hs-identifier hs-var hs-var">hGet</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Handle -&gt; Int -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetN"><span class="hs-identifier hs-var">hGetN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.ByteString.Lazy.Internal.html#defaultChunkSize"><span class="hs-identifier hs-var">defaultChunkSize</span></a></span><span>
</span><span id="line-1263"></span><span>
</span><span id="line-1264"></span><span class="hs-comment">-- | hGetNonBlocking is similar to 'hGet', except that it will never block</span><span>
</span><span id="line-1265"></span><span class="hs-comment">-- waiting for data to become available, instead it returns only whatever data</span><span>
</span><span id="line-1266"></span><span class="hs-comment">-- is available.  If there is no data available to be read, 'hGetNonBlocking'</span><span>
</span><span id="line-1267"></span><span class="hs-comment">-- returns 'empty'.</span><span>
</span><span id="line-1268"></span><span class="hs-comment">--</span><span>
</span><span id="line-1269"></span><span class="hs-comment">-- Note: on Windows and with Haskell implementation other than GHC, this</span><span>
</span><span id="line-1270"></span><span class="hs-comment">-- function does not work correctly; it behaves identically to 'hGet'.</span><span>
</span><span id="line-1271"></span><span class="hs-comment">--</span><span>
</span><span id="line-1272"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hGetNonBlocking"><span class="hs-identifier hs-type">hGetNonBlocking</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1273"></span><span id="hGetNonBlocking"><span class="annot"><span class="annottext">hGetNonBlocking :: Handle -&gt; Int -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetNonBlocking"><span class="hs-identifier hs-var hs-var">hGetNonBlocking</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Handle -&gt; Int -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetNonBlockingN"><span class="hs-identifier hs-var">hGetNonBlockingN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.ByteString.Lazy.Internal.html#defaultChunkSize"><span class="hs-identifier hs-var">defaultChunkSize</span></a></span><span>
</span><span id="line-1274"></span><span>
</span><span id="line-1275"></span><span class="hs-comment">-- | Read an entire file /lazily/ into a 'ByteString'.</span><span>
</span><span id="line-1276"></span><span class="hs-comment">-- The Handle will be held open until EOF is encountered.</span><span>
</span><span id="line-1277"></span><span class="hs-comment">--</span><span>
</span><span id="line-1278"></span><span class="annot"><a href="Data.ByteString.Lazy.html#readFile"><span class="hs-identifier hs-type">readFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1279"></span><span id="readFile"><span class="annot"><span class="annottext">readFile :: String -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#readFile"><span class="hs-identifier hs-var hs-var">readFile</span></a></span></span><span> </span><span id="local-6989586621679074864"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074864"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOMode -&gt; IO Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#openBinaryFile"><span class="hs-identifier hs-var">openBinaryFile</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074864"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="../../base/src/GHC.IO.IOMode.html#ReadMode"><span class="hs-identifier hs-var">ReadMode</span></a></span><span> </span><span class="annot"><span class="annottext">IO Handle -&gt; (Handle -&gt; IO ByteString) -&gt; IO ByteString
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetContents"><span class="hs-identifier hs-var">hGetContents</span></a></span><span>
</span><span id="line-1280"></span><span>
</span><span id="line-1281"></span><span class="annot"><a href="Data.ByteString.Lazy.html#modifyFile"><span class="hs-identifier hs-type">modifyFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.IOMode.html#IOMode"><span class="hs-identifier hs-type">IOMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1282"></span><span id="modifyFile"><span class="annot"><span class="annottext">modifyFile :: IOMode -&gt; String -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#modifyFile"><span class="hs-identifier hs-var hs-var">modifyFile</span></a></span></span><span> </span><span id="local-6989586621679074861"><span class="annot"><span class="annottext">IOMode
</span><a href="#local-6989586621679074861"><span class="hs-identifier hs-var">mode</span></a></span></span><span> </span><span id="local-6989586621679074860"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074860"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679074859"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074859"><span class="hs-identifier hs-var">txt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOMode -&gt; (Handle -&gt; IO ()) -&gt; IO ()
forall r. String -&gt; IOMode -&gt; (Handle -&gt; IO r) -&gt; IO r
</span><a href="../../base/src/System.IO.html#withBinaryFile"><span class="hs-identifier hs-var">withBinaryFile</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074860"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="#local-6989586621679074861"><span class="hs-identifier hs-var">mode</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#hPut"><span class="hs-operator hs-var">`hPut`</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074859"><span class="hs-identifier hs-var">txt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1283"></span><span>
</span><span id="line-1284"></span><span class="hs-comment">-- | Write a 'ByteString' to a file.</span><span>
</span><span id="line-1285"></span><span class="hs-comment">--</span><span>
</span><span id="line-1286"></span><span class="annot"><a href="Data.ByteString.Lazy.html#writeFile"><span class="hs-identifier hs-type">writeFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1287"></span><span id="writeFile"><span class="annot"><span class="annottext">writeFile :: String -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#writeFile"><span class="hs-identifier hs-var hs-var">writeFile</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOMode -&gt; String -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#modifyFile"><span class="hs-identifier hs-var">modifyFile</span></a></span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="../../base/src/GHC.IO.IOMode.html#WriteMode"><span class="hs-identifier hs-var">WriteMode</span></a></span><span>
</span><span id="line-1288"></span><span>
</span><span id="line-1289"></span><span class="hs-comment">-- | Append a 'ByteString' to a file.</span><span>
</span><span id="line-1290"></span><span class="hs-comment">--</span><span>
</span><span id="line-1291"></span><span class="annot"><a href="Data.ByteString.Lazy.html#appendFile"><span class="hs-identifier hs-type">appendFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1292"></span><span id="appendFile"><span class="annot"><span class="annottext">appendFile :: String -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#appendFile"><span class="hs-identifier hs-var hs-var">appendFile</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOMode -&gt; String -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#modifyFile"><span class="hs-identifier hs-var">modifyFile</span></a></span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="../../base/src/GHC.IO.IOMode.html#AppendMode"><span class="hs-identifier hs-var">AppendMode</span></a></span><span>
</span><span id="line-1293"></span><span>
</span><span id="line-1294"></span><span class="hs-comment">-- | getContents. Equivalent to hGetContents stdin. Will read /lazily/</span><span>
</span><span id="line-1295"></span><span class="hs-comment">--</span><span>
</span><span id="line-1296"></span><span class="annot"><a href="Data.ByteString.Lazy.html#getContents"><span class="hs-identifier hs-type">getContents</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1297"></span><span id="getContents"><span class="annot"><span class="annottext">getContents :: IO ByteString
</span><a href="Data.ByteString.Lazy.html#getContents"><span class="hs-identifier hs-var hs-var">getContents</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hGetContents"><span class="hs-identifier hs-var">hGetContents</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#stdin"><span class="hs-identifier hs-var">stdin</span></a></span><span>
</span><span id="line-1298"></span><span>
</span><span id="line-1299"></span><span class="hs-comment">-- | Outputs a 'ByteString' to the specified 'Handle'. The chunks will be</span><span>
</span><span id="line-1300"></span><span class="hs-comment">-- written one at a time. Other threads might write to the 'Handle' between the</span><span>
</span><span id="line-1301"></span><span class="hs-comment">-- writes, and hence 'hPut' alone might not be suitable for concurrent writes.</span><span>
</span><span id="line-1302"></span><span class="hs-comment">--</span><span>
</span><span id="line-1303"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hPut"><span class="hs-identifier hs-type">hPut</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1304"></span><span id="hPut"><span class="annot"><span class="annottext">hPut :: Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#hPut"><span class="hs-identifier hs-var hs-var">hPut</span></a></span></span><span> </span><span id="local-6989586621679074856"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074856"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span id="local-6989586621679074855"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074855"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; IO () -&gt; IO ()) -&gt; IO () -&gt; ByteString -&gt; IO ()
forall a. (ByteString -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Lazy.Internal.html#foldrChunks"><span class="hs-identifier hs-var">foldrChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679074854"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074854"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679074853"><span class="annot"><span class="annottext">IO ()
</span><a href="#local-6989586621679074853"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.html#hPut"><span class="hs-identifier hs-var">S.hPut</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074856"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074854"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO () -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IO ()
</span><a href="#local-6989586621679074853"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074855"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1305"></span><span>
</span><span id="line-1306"></span><span class="hs-comment">-- | Similar to 'hPut' except that it will never block. Instead it returns</span><span>
</span><span id="line-1307"></span><span class="hs-comment">-- any tail that did not get written. This tail may be 'empty' in the case that</span><span>
</span><span id="line-1308"></span><span class="hs-comment">-- the whole string was written, or the whole original string if nothing was</span><span>
</span><span id="line-1309"></span><span class="hs-comment">-- written. Partial writes are also possible.</span><span>
</span><span id="line-1310"></span><span class="hs-comment">--</span><span>
</span><span id="line-1311"></span><span class="hs-comment">-- Note: on Windows and with Haskell implementation other than GHC, this</span><span>
</span><span id="line-1312"></span><span class="hs-comment">-- function does not work correctly; it behaves identically to 'hPut'.</span><span>
</span><span id="line-1313"></span><span class="hs-comment">--</span><span>
</span><span id="line-1314"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hPutNonBlocking"><span class="hs-identifier hs-type">hPutNonBlocking</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1315"></span><span id="hPutNonBlocking"><span class="annot"><span class="annottext">hPutNonBlocking :: Handle -&gt; ByteString -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hPutNonBlocking"><span class="hs-identifier hs-var hs-var">hPutNonBlocking</span></a></span></span><span> </span><span class="annot"><span class="annottext">Handle
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-1316"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hPutNonBlocking"><span class="hs-identifier hs-var">hPutNonBlocking</span></a></span><span> </span><span id="local-6989586621679074851"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074851"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span id="local-6989586621679074850"><span class="annot"><span class="annottext">bs :: ByteString
</span><a href="#local-6989586621679074850"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span id="local-6989586621679074849"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074849"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679074848"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074848"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1317"></span><span>  </span><span id="local-6989586621679074847"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074847"><span class="hs-identifier hs-var">c'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ByteString
</span><a href="Data.ByteString.html#hPutNonBlocking"><span class="hs-identifier hs-var">S.hPutNonBlocking</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074851"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074849"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-1318"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074847"><span class="hs-identifier hs-var">c'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1319"></span><span>    </span><span id="local-6989586621679074845"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074845"><span class="hs-identifier hs-var">l'</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074845"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074849"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ByteString
</span><a href="Data.ByteString.Lazy.html#hPutNonBlocking"><span class="hs-identifier hs-var">hPutNonBlocking</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679074851"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074848"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1320"></span><span>    </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074850"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-1321"></span><span>    </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074847"><span class="hs-identifier hs-var">c'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074848"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1322"></span><span>
</span><span id="line-1323"></span><span class="hs-comment">-- | A synonym for @hPut@, for compatibility</span><span>
</span><span id="line-1324"></span><span class="hs-comment">--</span><span>
</span><span id="line-1325"></span><span class="annot"><a href="Data.ByteString.Lazy.html#hPutStr"><span class="hs-identifier hs-type">hPutStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1326"></span><span id="hPutStr"><span class="annot"><span class="annottext">hPutStr :: Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#hPutStr"><span class="hs-identifier hs-var hs-var">hPutStr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#hPut"><span class="hs-identifier hs-var">hPut</span></a></span><span>
</span><span id="line-1327"></span><span>
</span><span id="line-1328"></span><span class="hs-comment">-- | Write a ByteString to stdout</span><span>
</span><span id="line-1329"></span><span class="annot"><a href="Data.ByteString.Lazy.html#putStr"><span class="hs-identifier hs-type">putStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1330"></span><span id="putStr"><span class="annot"><span class="annottext">putStr :: ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#putStr"><span class="hs-identifier hs-var hs-var">putStr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#hPut"><span class="hs-identifier hs-var">hPut</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#stdout"><span class="hs-identifier hs-var">stdout</span></a></span><span>
</span><span id="line-1331"></span><span>
</span><span id="line-1332"></span><span class="hs-comment">-- | Write a ByteString to stdout, appending a newline byte</span><span>
</span><span id="line-1333"></span><span class="hs-comment">--</span><span>
</span><span id="line-1334"></span><span class="annot"><a href="Data.ByteString.Lazy.html#putStrLn"><span class="hs-identifier hs-type">putStrLn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1335"></span><span id="putStrLn"><span class="annot"><span class="annottext">putStrLn :: ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#putStrLn"><span class="hs-identifier hs-var hs-var">putStrLn</span></a></span></span><span> </span><span id="local-6989586621679074844"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074844"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#hPut"><span class="hs-identifier hs-var">hPut</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#stdout"><span class="hs-identifier hs-var">stdout</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679074844"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO () -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#hPut"><span class="hs-identifier hs-var">hPut</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#stdout"><span class="hs-identifier hs-var">stdout</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0x0a</span></span><span class="hs-special">)</span><span>
</span><span id="line-1336"></span><span>
</span><span id="line-1337"></span><span class="hs-pragma">{-# DEPRECATED</span><span> </span><span class="hs-pragma">putStrLn</span><span>
</span><span id="line-1338"></span><span>    </span><span class="hs-pragma">&quot;Use Data.ByteString.Lazy.Char8.putStrLn instead. (Functions that rely on ASCII encodings belong in Data.ByteString.Lazy.Char8)&quot;</span><span>
</span><span id="line-1339"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1340"></span><span>
</span><span id="line-1341"></span><span class="hs-comment">-- | The interact function takes a function of type @ByteString -&gt; ByteString@</span><span>
</span><span id="line-1342"></span><span class="hs-comment">-- as its argument. The entire input from the standard input device is passed</span><span>
</span><span id="line-1343"></span><span class="hs-comment">-- to this function as its argument, and the resulting string is output on the</span><span>
</span><span id="line-1344"></span><span class="hs-comment">-- standard output device.</span><span>
</span><span id="line-1345"></span><span class="hs-comment">--</span><span>
</span><span id="line-1346"></span><span class="annot"><a href="Data.ByteString.Lazy.html#interact"><span class="hs-identifier hs-type">interact</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1347"></span><span id="interact"><span class="annot"><span class="annottext">interact :: (ByteString -&gt; ByteString) -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#interact"><span class="hs-identifier hs-var hs-var">interact</span></a></span></span><span> </span><span id="local-6989586621679074843"><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679074843"><span class="hs-identifier hs-var">transformer</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; IO ()
</span><a href="Data.ByteString.Lazy.html#putStr"><span class="hs-identifier hs-var">putStr</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; IO ())
-&gt; (ByteString -&gt; ByteString) -&gt; ByteString -&gt; IO ()
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="#local-6989586621679074843"><span class="hs-identifier hs-var">transformer</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; IO ()) -&gt; IO ByteString -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3D%3C%3C"><span class="hs-operator hs-var">=&lt;&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">IO ByteString
</span><a href="Data.ByteString.Lazy.html#getContents"><span class="hs-identifier hs-var">getContents</span></a></span><span>
</span><span id="line-1348"></span><span>
</span><span id="line-1349"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-1350"></span><span class="hs-comment">-- Internal utilities</span><span>
</span><span id="line-1351"></span><span>
</span><span id="line-1352"></span><span class="hs-comment">-- Common up near identical calls to `error' to reduce the number</span><span>
</span><span id="line-1353"></span><span class="hs-comment">-- constant strings created when compiled:</span><span>
</span><span id="line-1354"></span><span id="local-6989586621679075927"><span class="annot"><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-type">errorEmptyList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075927"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1355"></span><span id="errorEmptyList"><span class="annot"><span class="annottext">errorEmptyList :: forall a. String -&gt; a
</span><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-identifier hs-var hs-var">errorEmptyList</span></a></span></span><span> </span><span id="local-6989586621679074841"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074841"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; a
forall a. String -&gt; String -&gt; a
</span><a href="Data.ByteString.Lazy.html#moduleError"><span class="hs-identifier hs-var">moduleError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074841"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;empty ByteString&quot;</span></span><span>
</span><span id="line-1356"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#errorEmptyList"><span class="hs-pragma hs-type">errorEmptyList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1357"></span><span>
</span><span id="line-1358"></span><span id="local-6989586621679075892"><span class="annot"><a href="Data.ByteString.Lazy.html#moduleError"><span class="hs-identifier hs-type">moduleError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679075892"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1359"></span><span id="moduleError"><span class="annot"><span class="annottext">moduleError :: forall a. String -&gt; String -&gt; a
</span><a href="Data.ByteString.Lazy.html#moduleError"><span class="hs-identifier hs-var hs-var">moduleError</span></a></span></span><span> </span><span id="local-6989586621679074838"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074838"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621679074837"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074837"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.ByteString.Lazy.&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074838"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679074837"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1360"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#moduleError"><span class="hs-pragma hs-type">moduleError</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1361"></span><span>
</span><span id="line-1362"></span><span>
</span><span id="line-1363"></span><span class="hs-comment">-- reverse a list of non-empty chunks into a lazy ByteString</span><span>
</span><span id="line-1364"></span><span class="annot"><a href="Data.ByteString.Lazy.html#revNonEmptyChunks"><span class="hs-identifier hs-type">revNonEmptyChunks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1365"></span><span id="revNonEmptyChunks"><span class="annot"><span class="annottext">revNonEmptyChunks :: [ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revNonEmptyChunks"><span class="hs-identifier hs-var hs-var">revNonEmptyChunks</span></a></span></span><span> </span><span id="local-6989586621679074835"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679074835"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; ByteString -&gt; [ByteString] -&gt; ByteString
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">L.foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; ByteString -&gt; ByteString -&gt; ByteString
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679074835"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1366"></span><span>
</span><span id="line-1367"></span><span class="hs-comment">-- reverse a list of possibly-empty chunks into a lazy ByteString</span><span>
</span><span id="line-1368"></span><span class="annot"><a href="Data.ByteString.Lazy.html#revChunks"><span class="hs-identifier hs-type">revChunks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-1369"></span><span id="revChunks"><span class="annot"><span class="annottext">revChunks :: [ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Lazy.html#revChunks"><span class="hs-identifier hs-var hs-var">revChunks</span></a></span></span><span> </span><span id="local-6989586621679074833"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679074833"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; ByteString -&gt; [ByteString] -&gt; ByteString
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">L.foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString -&gt; ByteString)
-&gt; ByteString -&gt; ByteString -&gt; ByteString
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#chunk"><span class="hs-identifier hs-var">chunk</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679074833"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1370"></span><span>
</span><span id="line-1371"></span><span class="hs-comment">-- | 'findIndexOrEnd' is a variant of findIndex, that returns the length</span><span>
</span><span id="line-1372"></span><span class="hs-comment">-- of the string if no element is found, rather than Nothing.</span><span>
</span><span id="line-1373"></span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndexOrEnd"><span class="hs-identifier hs-type">findIndexOrEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">P.ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-1374"></span><span id="findIndexOrEnd"><span class="annot"><span class="annottext">findIndexOrEnd :: (Word8 -&gt; Bool) -&gt; ByteString -&gt; Int
</span><a href="Data.ByteString.Lazy.html#findIndexOrEnd"><span class="hs-identifier hs-var hs-var">findIndexOrEnd</span></a></span></span><span> </span><span id="local-6989586621679074832"><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679074832"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-type">S.PS</span></a></span><span> </span><span id="local-6989586621679074831"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679074831"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679074830"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074830"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679074829"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074829"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1375"></span><span>    </span><span class="annot"><span class="annottext">IO Int -&gt; Int
forall a. IO a -&gt; a
</span><a href="Data.ByteString.Internal.html#accursedUnutterablePerformIO"><span class="hs-identifier hs-var">S.accursedUnutterablePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO Int -&gt; Int) -&gt; IO Int -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1376"></span><span>      </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; (Ptr Word8 -&gt; IO Int) -&gt; IO Int
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/GHC.ForeignPtr.html#withForeignPtr"><span class="hs-identifier hs-var">withForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679074831"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO Int) -&gt; IO Int)
-&gt; (Ptr Word8 -&gt; IO Int) -&gt; IO Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679074827"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679074827"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; IO Int
</span><a href="#local-6989586621679074826"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679074827"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074830"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1377"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1378"></span><span>    </span><span id="local-6989586621679074826"><span class="annot"><span class="annottext">go :: Ptr Word8 -&gt; Int -&gt; IO Int
</span><a href="#local-6989586621679074826"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679074818"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679074818"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679074817"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074817"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074817"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074829"><span class="hs-identifier hs-var">l</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO Int
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074829"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1379"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679074816"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679074816"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; IO Word8
forall a. Storable a =&gt; Ptr a -&gt; IO a
</span><a href="../../base/src/Foreign.Storable.html#peek"><span class="hs-identifier hs-var">peek</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679074818"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-1380"></span><span>                                </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="#local-6989586621679074832"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679074816"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-1381"></span><span>                                  </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO Int
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074817"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1382"></span><span>                                  </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; IO Int
</span><a href="#local-6989586621679074826"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679074818"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679074817"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-1383"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.html#findIndexOrEnd"><span class="hs-pragma hs-type">findIndexOrEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1384"></span></pre></body></html>